SubjectPublicKeyInfopublic class SubjectPublicKeyInfo extends Object The class encapsulates the ASN.1 DER encoding/decoding work
with the following structure which is a 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):
SubjectPublicKeyInfo ::= SEQUENCE {
algorithm AlgorithmIdentifier,
subjectPublicKey BIT STRING
}
|
Fields Summary |
---|
private AlgorithmIdentifier | algorithmID | private byte[] | subjectPublicKey | private PublicKey | publicKey | private int | unusedBits | private byte[] | encoding | public static final org.apache.harmony.security.asn1.ASN1Sequence | ASN1 |
Constructors Summary |
---|
public SubjectPublicKeyInfo(AlgorithmIdentifier algID, byte[] subjectPublicKey)TODO
this(algID, subjectPublicKey, 0);
| public SubjectPublicKeyInfo(AlgorithmIdentifier algID, byte[] subjectPublicKey, int unused)TODO
this(algID, subjectPublicKey, 0, null);
| private SubjectPublicKeyInfo(AlgorithmIdentifier algID, byte[] subjectPublicKey, int unused, byte[] encoding)
this.algorithmID = algID;
this.subjectPublicKey = subjectPublicKey;
this.unusedBits = unused;
this.encoding = encoding;
|
Methods Summary |
---|
public AlgorithmIdentifier | getAlgorithmIdentifier()Returns the value of algorithmIdentifier field of the structure.
return algorithmID;
| public byte[] | getEncoded()Returns ASN.1 encoded form of this X.509 SubjectPublicKeyInfo value.
if (encoding == null) {
encoding = ASN1.encode(this);
}
return encoding;
| public java.security.PublicKey | getPublicKey()Returns The PublicKey corresponding to this SubjectPublicKeyInfo
instance.
if (publicKey == null) {
String alg_oid = algorithmID.getAlgorithm();
try {
String alg =
AlgNameMapper.map2AlgName(alg_oid);
if (alg == null) {
alg = alg_oid;
}
publicKey = KeyFactory.getInstance(alg)
.generatePublic(new X509EncodedKeySpec(getEncoded()));
} catch (InvalidKeySpecException e) {
} catch (NoSuchAlgorithmException e) {
}
if (publicKey == null) {
publicKey = new X509PublicKey(alg_oid, getEncoded(),
subjectPublicKey);
}
}
return publicKey;
| public byte[] | getSubjectPublicKey()Returns the value of subjectPublicKey field of the structure.
return subjectPublicKey;
| public int | getUnusedBits()Returns the value of unusedBits field of the structure.
return unusedBits;
|
|