TBSCertificatepublic 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 | ASN1X.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)
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
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 void | dumpValue(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.
if (encoding == null) {
encoding = ASN1.encode(this);
}
return encoding;
| public Extensions | getExtensions()Returns the value of extensions field of the structure.
return extensions;
| public org.apache.harmony.security.x501.Name | getIssuer()Returns the value of issuer field of the structure.
return issuer;
| public boolean[] | getIssuerUniqueID()Returns the value of issuerUniqueID field of the structure.
return issuerUniqueID;
| public java.math.BigInteger | getSerialNumber()Returns the value of serialNumber field of the structure.
return serialNumber;
| public AlgorithmIdentifier | getSignature()Returns the value of signature field of the structure.
return signature;
| public org.apache.harmony.security.x501.Name | getSubject()Returns the value of subject field of the structure.
return subject;
| public SubjectPublicKeyInfo | getSubjectPublicKeyInfo()Returns the value of subjectPublicKeyInfo field of the structure.
return subjectPublicKeyInfo;
| public boolean[] | getSubjectUniqueID()Returns the value of subjectUniqueID field of the structure.
return subjectUniqueID;
| public Validity | getValidity()Returns the value of validity field of the structure.
return validity;
| public int | getVersion()Returns the value of version field of the structure.
return version;
|
|