public class SubjectPublicKeyInfo extends java.security.spec.X509EncodedKeySpec implements ASN1Value, java.security.PublicKey
java.security.PublicKey
.Modifier and Type | Class and Description |
---|---|
static class |
SubjectPublicKeyInfo.Template |
Constructor and Description |
---|
SubjectPublicKeyInfo(AlgorithmIdentifier algorithm,
BIT_STRING subjectPublicKey) |
SubjectPublicKeyInfo(java.security.PublicKey pubk) |
Modifier and Type | Method and Description |
---|---|
void |
encode(java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using
its own base tag.
|
void |
encode(Tag implicit,
java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using
an implicit tag.
|
java.lang.String |
getAlgorithm() |
AlgorithmIdentifier |
getAlgorithmIdentifier() |
byte[] |
getEncoded() |
BIT_STRING |
getSubjectPublicKey() |
Tag |
getTag()
Returns the base tag for this type, not counting any tags
that may be imposed on it by its context.
|
static SubjectPublicKeyInfo.Template |
getTemplate() |
java.security.PublicKey |
toPublicKey()
Creates a PublicKey from the public key information.
|
public static final Tag TAG
public SubjectPublicKeyInfo(AlgorithmIdentifier algorithm, BIT_STRING subjectPublicKey)
public SubjectPublicKeyInfo(java.security.PublicKey pubk) throws InvalidBERException, java.io.IOException
InvalidBERException
java.io.IOException
public java.lang.String getAlgorithm()
getAlgorithm
in interface java.security.Key
public byte[] getEncoded()
getEncoded
in interface java.security.Key
getEncoded
in class java.security.spec.X509EncodedKeySpec
public AlgorithmIdentifier getAlgorithmIdentifier()
public BIT_STRING getSubjectPublicKey()
public Tag getTag()
ASN1Value
public void encode(java.io.OutputStream ostream) throws java.io.IOException
ASN1Value
public void encode(Tag implicit, java.io.OutputStream ostream) throws java.io.IOException
ASN1Value
public static SubjectPublicKeyInfo.Template getTemplate()
public java.security.PublicKey toPublicKey() throws java.security.NoSuchAlgorithmException, InvalidKeyFormatException
java.security.NoSuchAlgorithmException
- If the cryptographic provider
does not recognize the algorithm for this public key.InvalidKeyFormatException
- If the subjectPublicKey could
not be decoded correctly.