Class PK11PubKey
java.lang.Object
org.mozilla.jss.pkcs11.PK11Key
org.mozilla.jss.pkcs11.PK11PubKey
- All Implemented Interfaces:
Serializable, AutoCloseable, AsymmetricKey, DEREncodablePREVIEW, Key, PublicKey
- Direct Known Subclasses:
PK11DSAPublicKey, PK11ECPublicKey, PK11RSAPublicKey
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static PK11PubKeyDSAFromRaw(byte[] rawKey) deprecated Use fromRawNative instead.static PK11PubKeyfromRaw(PrivateKey.Type type, byte[] rawKey) Deprecated.This method works for RSA keys but not DSA or EC keys.private static PK11PubKeyfromRawNative(int type, byte[] rawKey) param type The PKCS #11 type of the key (CKK_).static PK11PubKeyfromSPKI(byte[] spki) Creates a PK11PubKey from a SubjectPublicKeyInfo.byte[]Returns a DER-encoded SubjectPublicKeyInfo representing this key.The name of the primary encoding format of this key.private static PK11PubKeyRSAFromRaw(byte[] rawKey) deprecated Use fromRawNative instead.voidverifyKeyIsOnToken(PK11Token token) Make sure this key lives on the given token.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AsymmetricKey
getParams
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
PK11PubKey
protected PK11PubKey(byte[] pointer)
-
-
Method Details
-
verifyKeyIsOnToken
Make sure this key lives on the given token.- Throws:
NoSuchItemOnTokenException
-
getKeyType
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceKey
-
fromRaw
@Deprecated public static PK11PubKey fromRaw(PrivateKey.Type type, byte[] rawKey) throws InvalidKeyFormatException Deprecated.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.- Parameters:
type- The type of private key to be decoded.rawKey- The bytes of the raw key.- Throws:
InvalidKeyFormatException- If the raw key could not be decoded.- See Also:
-
fromRawNative
param type The PKCS #11 type of the key (CKK_).- Throws:
InvalidKeyFormatException
-
fromSPKI
Creates a PK11PubKey from a SubjectPublicKeyInfo.- Parameters:
spki- The BER-encoded SubjectPublicKeyInfo.- Throws:
InvalidKeyFormatException- If the SPKI could not be decoded.
-
RSAFromRaw
deprecated Use fromRawNative instead. -
DSAFromRaw
deprecated Use fromRawNative instead. -
getEncoded
public byte[] getEncoded()Returns a DER-encoded SubjectPublicKeyInfo representing this key.- Specified by:
getEncodedin interfaceKey- Overrides:
getEncodedin classPK11Key
-
getFormat
-