FileDocCategorySizeDatePackage
TBSCertificate.javaAPI DocAndroid 1.5 API13200Wed May 06 22:41:06 BST 2009org.apache.harmony.security.x509

TBSCertificate

public class TBSCertificate extends Object
The class encapsulates the ASN.1 DER encoding/decoding work with TBSCertificate structure which is the part of X.509 certificate (as specified in RFC 3280 - Internet X.509 Public Key Infrastructure. Certificate and Certificate Revocation List (CRL) Profile. http://www.ietf.org/rfc/rfc3280.txt):
TBSCertificate ::= SEQUENCE {
version [0] EXPLICIT Version DEFAULT v1,
serialNumber CertificateSerialNumber,
signature AlgorithmIdentifier,
issuer Name,
validity Validity,
subject Name,
subjectPublicKeyInfo SubjectPublicKeyInfo,
issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
-- If present, version MUST be v2 or v3
subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,
-- If present, version MUST be v2 or v3
extensions [3] EXPLICIT Extensions OPTIONAL
-- If present, version MUST be v3
}

Fields Summary
private final int
version
private final BigInteger
serialNumber
private final AlgorithmIdentifier
signature
private final org.apache.harmony.security.x501.Name
issuer
private final Validity
validity
private final org.apache.harmony.security.x501.Name
subject
private final SubjectPublicKeyInfo
subjectPublicKeyInfo
private final boolean[]
issuerUniqueID
private final boolean[]
subjectUniqueID
private final Extensions
extensions
byte[]
encoding
public static final org.apache.harmony.security.asn1.ASN1Sequence
ASN1
X.509 TBSCertificate encoder/decoder.
Constructors Summary
public TBSCertificate(int version, BigInteger serialNumber, AlgorithmIdentifier signature, org.apache.harmony.security.x501.Name issuer, Validity validity, org.apache.harmony.security.x501.Name subject, SubjectPublicKeyInfo subjectPublicKeyInfo)
Constructs the instance of TBSCertificate without optional fields (issuerUniqueID, subjectUniqueID, extensions)

param
version : int
param
serialNumber : BigInteger
param
signature : AlgorithmIdentifier
param
issuer : Name
param
validity : Validity
param
subject : Name
param
subjectPublicKeyInfo : SubjectPublicKeyInfo

        this(version, serialNumber, signature, issuer, validity, subject, 
             subjectPublicKeyInfo, null, null, null);
    
public TBSCertificate(int version, BigInteger serialNumber, AlgorithmIdentifier signature, org.apache.harmony.security.x501.Name issuer, Validity validity, org.apache.harmony.security.x501.Name subject, SubjectPublicKeyInfo subjectPublicKeyInfo, boolean[] issuerUniqueID, boolean[] subjectUniqueID, Extensions extensions)
TODO

param
version: int
param
serialNumber: BigInteger
param
signature: AlgorithmIdentifier
param
issuer: Name
param
validity: Validity
param
subject: Name
param
subjectPublicKeyInfo: SubjectPublicKeyInfo
param
issuerUniqueID: byte[]
param
subjectUniqueID: byte[]
param
extensions: Extensions

        this.version = version; 
        this.serialNumber = serialNumber;
        this.signature = signature; 
        this.issuer = issuer;
        this.validity = validity;
        this.subject = subject;
        this.subjectPublicKeyInfo = subjectPublicKeyInfo;
        this.issuerUniqueID = issuerUniqueID;
        this.subjectUniqueID = subjectUniqueID;
        this.extensions = extensions;
    
private TBSCertificate(int version, BigInteger serialNumber, AlgorithmIdentifier signature, org.apache.harmony.security.x501.Name issuer, Validity validity, org.apache.harmony.security.x501.Name subject, SubjectPublicKeyInfo subjectPublicKeyInfo, boolean[] issuerUniqueID, boolean[] subjectUniqueID, Extensions extensions, byte[] encoding)

        this(version, serialNumber, signature, issuer, validity, subject, 
             subjectPublicKeyInfo, issuerUniqueID, subjectUniqueID, extensions);
        this.encoding = encoding;
    
Methods Summary
public voiddumpValue(java.lang.StringBuffer buffer)
Places the string representation into the StringBuffer object.

        buffer.append('[");
        buffer.append("\n  Version: V").append(version+1); //$NON-NLS-1$
        buffer.append("\n  Subject: ") //$NON-NLS-1$
            .append(subject.getName(X500Principal.RFC2253));
        buffer.append("\n  Signature Algorithm: "); //$NON-NLS-1$
        signature.dumpValue(buffer);
        buffer.append("\n  Key: "); //$NON-NLS-1$
        buffer.append(subjectPublicKeyInfo.getPublicKey().toString());
        buffer.append("\n  Validity: [From: "); //$NON-NLS-1$
        buffer.append(validity.getNotBefore());
        buffer.append("\n               To: "); //$NON-NLS-1$
        buffer.append(validity.getNotAfter()).append(']");
        buffer.append("\n  Issuer: "); //$NON-NLS-1$
        buffer.append(issuer.getName(X500Principal.RFC2253));
        buffer.append("\n  Serial Number: "); //$NON-NLS-1$
        buffer.append(serialNumber);
        if (issuerUniqueID != null) {
            buffer.append("\n  Issuer Id: "); //$NON-NLS-1$
            for (int i=0; i<issuerUniqueID.length; i++) {
                buffer.append(issuerUniqueID[i] ? '1" : '0");
            }
        }
        if (subjectUniqueID != null) {
            buffer.append("\n  Subject Id: "); //$NON-NLS-1$
            for (int i=0; i<subjectUniqueID.length; i++) {
                buffer.append(subjectUniqueID[i] ? '1" : '0");
            }
        }
        if (extensions != null) {
            buffer.append("\n\n  Extensions: "); //$NON-NLS-1$
            buffer.append("[\n"); //$NON-NLS-1$
            extensions.dumpValue(buffer, "    "); //$NON-NLS-1$
            buffer.append("  ]"); //$NON-NLS-1$
        }
        buffer.append("\n]"); //$NON-NLS-1$
    
public byte[]getEncoded()
Returns ASN.1 encoded form of this X.509 TBSCertificate value.

return
a byte array containing ASN.1 encode form.

        if (encoding == null) {
            encoding = ASN1.encode(this);
        }
        return encoding;
    
public ExtensionsgetExtensions()
Returns the value of extensions field of the structure.

return
extensions

        return extensions;
    
public org.apache.harmony.security.x501.NamegetIssuer()
Returns the value of issuer field of the structure.

return
issuer

        return issuer;
    
public boolean[]getIssuerUniqueID()
Returns the value of issuerUniqueID field of the structure.

return
issuerUniqueID

        return issuerUniqueID;
    
public java.math.BigIntegergetSerialNumber()
Returns the value of serialNumber field of the structure.

return
serialNumber

        return serialNumber;
    
public AlgorithmIdentifiergetSignature()
Returns the value of signature field of the structure.

return
signature

        return signature;
    
public org.apache.harmony.security.x501.NamegetSubject()
Returns the value of subject field of the structure.

return
subject

        return subject;
    
public SubjectPublicKeyInfogetSubjectPublicKeyInfo()
Returns the value of subjectPublicKeyInfo field of the structure.

return
subjectPublicKeyInfo

        return subjectPublicKeyInfo;
    
public boolean[]getSubjectUniqueID()
Returns the value of subjectUniqueID field of the structure.

return
subjectUniqueID

        return subjectUniqueID;
    
public ValiditygetValidity()
Returns the value of validity field of the structure.

return
validity

        return validity;
    
public intgetVersion()
Returns the value of version field of the structure.

return
version

        return version;