org.mozilla.jss.pkcs11
Class PK11PubKey
java.lang.Object
org.mozilla.jss.pkcs11.PK11Key
org.mozilla.jss.pkcs11.PK11PubKey
- java.security.PublicKey
public class PK11PubKey
extends org.mozilla.jss.pkcs11.PK11Key
implements java.security.PublicKey
PK11PubKey
protected PK11PubKey(byte[] pointer)
fromRaw
public static PK11PubKey fromRaw(PrivateKey.Type type,
byte[] rawKey)
throws InvalidKeyFormatException
This method works for RSA keys but not DSA or EC keys. Use
fromSPKI() instead.
Creates a PK11PubKey from its raw form. The raw form is a DER encoding
of the public key. For example, this is what is stored in a
SubjectPublicKeyInfo.
type
- The type of private key to be decoded.rawKey
- The bytes of the raw key.
fromSPKI
public static PK11PubKey fromSPKI(byte[] spki)
throws InvalidKeyFormatException
Creates a PK11PubKey from a SubjectPublicKeyInfo.
spki
- The BER-encoded SubjectPublicKeyInfo.
getAlgorithm
public String getAlgorithm()
getEncoded
public byte[] getEncoded()
Returns a DER-encoded SubjectPublicKeyInfo representing this key.
- getEncoded in interface org.mozilla.jss.pkcs11.PK11Key
getFormat
public String getFormat()
The name of the primary encoding format of this key. The primary
encoding format is X.509 SubjectPublicKeyInfo, and the name
is "X.509".
- getFormat in interface org.mozilla.jss.pkcs11.PK11Key
getKeyType
public KeyType getKeyType()