FileDocCategorySizeDatePackage
SslCertificate.javaAPI DocAndroid 1.5 API7457Wed May 06 22:41:56 BST 2009android.net.http

SslCertificate

public class SslCertificate extends Object
SSL certificate info (certificate details) class

Fields Summary
private DName
mIssuedTo
Name of the entity this certificate is issued to
private DName
mIssuedBy
Name of the entity this certificate is issued by
private String
mValidNotBefore
Not-before date from the validity period
private String
mValidNotAfter
Not-after date from the validity period
private static final String
ISSUED_TO
Bundle key names
private static final String
ISSUED_BY
private static final String
VALID_NOT_BEFORE
private static final String
VALID_NOT_AFTER
Constructors Summary
public SslCertificate(String issuedTo, String issuedBy, String validNotBefore, String validNotAfter)
Creates a new SSL certificate object

param
issuedTo The entity this certificate is issued to
param
issuedBy The entity that issued this certificate
param
validNotBefore The not-before date from the certificate validity period
param
validNotAfter The not-after date from the certificate validity period

        mIssuedTo = new DName(issuedTo);
        mIssuedBy = new DName(issuedBy);

        mValidNotBefore = validNotBefore;
        mValidNotAfter = validNotAfter;
    
public SslCertificate(X509Certificate certificate)
Creates a new SSL certificate object from an X509 certificate

param
certificate X509 certificate

        this(certificate.getSubjectDN().getName(),
             certificate.getIssuerDN().getName(),
             DateFormat.getInstance().format(certificate.getNotBefore()),
             DateFormat.getInstance().format(certificate.getNotAfter()));
    
Methods Summary
public android.net.http.SslCertificate$DNamegetIssuedBy()

return
Issued-by distinguished name or null if none has been set

        return mIssuedBy;
    
public android.net.http.SslCertificate$DNamegetIssuedTo()

return
Issued-to distinguished name or null if none has been set

        return mIssuedTo;
    
public java.lang.StringgetValidNotAfter()

return
Not-after date from the certificate validity period or "" if none has been set

        return mValidNotAfter != null ? mValidNotAfter : "";
    
public java.lang.StringgetValidNotBefore()

return
Not-before date from the certificate validity period or "" if none has been set

        return mValidNotBefore != null ? mValidNotBefore : "";
    
public static android.net.http.SslCertificaterestoreState(android.os.Bundle bundle)
Restores the certificate stored in the bundle

param
bundle The bundle with the certificate state stored in it
return
The SSL certificate stored in the bundle or null if fails

        if (bundle != null) {
            return new SslCertificate(
                bundle.getString(ISSUED_TO),
                bundle.getString(ISSUED_BY),
                bundle.getString(VALID_NOT_BEFORE),
                bundle.getString(VALID_NOT_AFTER));
        }

        return null;
    
public static android.os.BundlesaveState(android.net.http.SslCertificate certificate)
Saves the certificate state to a bundle

param
certificate The SSL certificate to store
return
A bundle with the certificate stored in it or null if fails


                                    
         
        Bundle bundle = null;

        if (certificate != null) {
            bundle = new Bundle();

            bundle.putString(ISSUED_TO, certificate.getIssuedTo().getDName());
            bundle.putString(ISSUED_BY, certificate.getIssuedBy().getDName());

            bundle.putString(VALID_NOT_BEFORE, certificate.getValidNotBefore());
            bundle.putString(VALID_NOT_AFTER, certificate.getValidNotAfter());
        }

        return bundle;
    
public java.lang.StringtoString()

return
A string representation of this certificate for debugging

        return
            "Issued to: " + mIssuedTo.getDName() + ";\n" +
            "Issued by: " + mIssuedBy.getDName() + ";\n";