org.mozilla.jss.pkix.primitive

Class SubjectPublicKeyInfo

Implemented Interfaces:
ASN1Value, java.security.PublicKey

public class SubjectPublicKeyInfo
extends java.security.spec.X509EncodedKeySpec
implements ASN1Value, java.security.PublicKey

A SubjectPublicKeyInfo, which stores information about a public key. This class implements java.security.PublicKey.

Nested Class Summary

static class
SubjectPublicKeyInfo.Template

Field Summary

static Tag
TAG

Constructor Summary

SubjectPublicKeyInfo(PublicKey pubk)
SubjectPublicKeyInfo(AlgorithmIdentifier algorithm, BIT_STRING subjectPublicKey)

Method Summary

void
encode(OutputStream ostream)
Write this value's DER encoding to an output stream using its own base tag.
void
encode(Tag implicit, OutputStream ostream)
Write this value's DER encoding to an output stream using an implicit tag.
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()
PublicKey
toPublicKey()
Creates a PublicKey from the public key information.

Field Details

TAG

public static final Tag TAG

Constructor Details

SubjectPublicKeyInfo

public SubjectPublicKeyInfo(PublicKey pubk)
            throws InvalidBERException,
                   IOException

SubjectPublicKeyInfo

public SubjectPublicKeyInfo(AlgorithmIdentifier algorithm,
                            BIT_STRING subjectPublicKey)

Method Details

encode

public void encode(OutputStream ostream)
            throws IOException
Write this value's DER encoding to an output stream using its own base tag.
Specified by:
encode in interface ASN1Value

encode

public void encode(Tag implicit,
                   OutputStream ostream)
            throws IOException
Write this value's DER encoding to an output stream using an implicit tag.
Specified by:
encode in interface ASN1Value

getAlgorithm

public String getAlgorithm()

getAlgorithmIdentifier

public AlgorithmIdentifier getAlgorithmIdentifier()

getEncoded

public byte[] getEncoded()

getSubjectPublicKey

public BIT_STRING getSubjectPublicKey()

getTag

public Tag getTag()
Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
Specified by:
getTag in interface ASN1Value

getTemplate

public static SubjectPublicKeyInfo.Template getTemplate()

toPublicKey

public PublicKey toPublicKey()
            throws NoSuchAlgorithmException,
                   InvalidKeyFormatException
Creates a PublicKey from the public key information. Currently only RSA and DSA keys can be converted.
Throws:
InvalidKeyFormatException - If the subjectPublicKey could not be decoded correctly.