Package org.mozilla.jss.pkix.primitive
Class SubjectPublicKeyInfo
- java.lang.Object
-
- java.security.spec.EncodedKeySpec
-
- java.security.spec.X509EncodedKeySpec
-
- org.mozilla.jss.pkix.primitive.SubjectPublicKeyInfo
-
- All Implemented Interfaces:
java.io.Serializable
,java.security.Key
,java.security.PublicKey
,java.security.spec.KeySpec
,ASN1Value
public class SubjectPublicKeyInfo extends java.security.spec.X509EncodedKeySpec implements ASN1Value, java.security.PublicKey
A SubjectPublicKeyInfo, which stores information about a public key. This class implementsjava.security.PublicKey
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SubjectPublicKeyInfo.Template
-
Constructor Summary
Constructors Constructor Description SubjectPublicKeyInfo(java.security.PublicKey pubk)
SubjectPublicKeyInfo(AlgorithmIdentifier algorithm, BIT_STRING subjectPublicKey)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
TAG
public static final Tag TAG
-
-
Constructor Detail
-
SubjectPublicKeyInfo
public SubjectPublicKeyInfo(AlgorithmIdentifier algorithm, BIT_STRING subjectPublicKey)
-
SubjectPublicKeyInfo
public SubjectPublicKeyInfo(java.security.PublicKey pubk) throws InvalidBERException, java.io.IOException
- Throws:
InvalidBERException
java.io.IOException
-
-
Method Detail
-
getAlgorithm
public java.lang.String getAlgorithm()
- Specified by:
getAlgorithm
in interfacejava.security.Key
- Overrides:
getAlgorithm
in classjava.security.spec.EncodedKeySpec
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncoded
in interfacejava.security.Key
- Overrides:
getEncoded
in classjava.security.spec.X509EncodedKeySpec
-
getAlgorithmIdentifier
public AlgorithmIdentifier getAlgorithmIdentifier()
-
getSubjectPublicKey
public BIT_STRING getSubjectPublicKey()
-
getTag
public Tag getTag()
Description copied from interface:ASN1Value
Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
-
encode
public void encode(java.io.OutputStream ostream) throws java.io.IOException
Description copied from interface:ASN1Value
Write this value's DER encoding to an output stream using its own base tag.
-
encode
public void encode(Tag implicit, java.io.OutputStream ostream) throws java.io.IOException
Description copied from interface:ASN1Value
Write this value's DER encoding to an output stream using an implicit tag.
-
getTemplate
public static SubjectPublicKeyInfo.Template getTemplate()
-
toPublicKey
public java.security.PublicKey toPublicKey() throws java.security.NoSuchAlgorithmException, InvalidKeyFormatException
Creates a PublicKey from the public key information. Currently only RSA and DSA keys can be converted.- Throws:
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.
-
-