public class PK11PubKey
extends java.lang.Object
implements java.security.PublicKey
Modifier and Type | Field and Description |
---|---|
protected org.mozilla.jss.pkcs11.KeyProxy |
keyProxy |
Modifier | Constructor and Description |
---|---|
protected |
PK11PubKey(byte[] pointer) |
Modifier and Type | Method and Description |
---|---|
static PK11PubKey |
fromRaw(PrivateKey.Type type,
byte[] rawKey)
Deprecated.
This method works for RSA keys but not DSA or EC keys. Use
fromSPKI() instead.
|
static PK11PubKey |
fromSPKI(byte[] spki)
Creates a PK11PubKey from a SubjectPublicKeyInfo.
|
java.lang.String |
getAlgorithm() |
byte[] |
getEncoded()
Returns a DER-encoded SubjectPublicKeyInfo representing this key.
|
java.lang.String |
getFormat()
The name of the primary encoding format of this key.
|
KeyType |
getKeyType() |
void |
verifyKeyIsOnToken(PK11Token token)
Make sure this key lives on the given token.
|
public void verifyKeyIsOnToken(PK11Token token) throws NoSuchItemOnTokenException
NoSuchItemOnTokenException
public KeyType getKeyType()
public java.lang.String getAlgorithm()
getAlgorithm
in interface java.security.Key
public static PK11PubKey fromRaw(PrivateKey.Type type, byte[] rawKey) throws InvalidKeyFormatException
type
- The type of private key to be decoded.rawKey
- The bytes of the raw key.InvalidKeyFormatException
- If the raw key could not be
decoded.fromSPKI(byte[])
public static PK11PubKey fromSPKI(byte[] spki) throws InvalidKeyFormatException
spki
- The BER-encoded SubjectPublicKeyInfo.InvalidKeyFormatException
- If the SPKI could not be
decoded.public byte[] getEncoded()
getEncoded
in interface java.security.Key
public java.lang.String getFormat()
getFormat
in interface java.security.Key