public class PK11PrivKey extends java.lang.Object implements PrivateKey
PrivateKey.Type
Modifier and Type | Field and Description |
---|---|
protected org.mozilla.jss.pkcs11.KeyProxy |
keyProxy |
DiffieHellman, DSA, EC, RSA
Modifier | Constructor and Description |
---|---|
protected |
PK11PrivKey(byte[] pointer) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
finalize() |
static PK11PrivKey |
fromPrivateKeyInfo(byte[] pki,
CryptoToken token)
Imports a PrivateKeyInfo, storing it as a temporary PrivateKey
on the given token.
|
static PK11PrivKey |
fromPrivateKeyInfo(byte[] pki,
CryptoToken token,
byte[] publicValue)
Imports a PrivateKeyInfo, storing it as a temporary PrivateKey
on the given token.
|
static PK11PrivKey |
fromPrivateKeyInfo(java.security.spec.PKCS8EncodedKeySpec spec,
CryptoToken token)
Imports a PrivateKeyInfo, storing it as a temporary PrivateKey
on the given token.
|
java.lang.String |
getAlgorithm() |
protected java.security.spec.DSAParameterSpec |
getDSAParams() |
byte[] |
getEncoded()
Subclasses that support encoding can overload this method.
|
java.lang.String |
getFormat()
Subclasses that support encoding can overload this method.
|
KeyType |
getKeyType() |
CryptoToken |
getOwningToken()
Returns a new CryptoToken where this key resides.
|
PK11PubKey |
getPublicKey()
Returns the corresponding public key from a private key instance.
|
int |
getStrength()
Returns the size in bits of the modulus of an RSA Private key.
|
PrivateKey.Type |
getType()
Returns the type (RSA or DSA) of this private key.
|
byte[] |
getUniqueID()
Returns the unique ID of this key.
|
void |
verifyKeyIsOnToken(PK11Token token)
Make sure this key lives on the given token.
|
public void verifyKeyIsOnToken(PK11Token token) throws NoSuchItemOnTokenException
NoSuchItemOnTokenException
public CryptoToken getOwningToken()
public byte[] getUniqueID() throws TokenException
PrivateKey
TokenException
TokenCertificate.getUniqueID()
public KeyType getKeyType()
public PrivateKey.Type getType()
PrivateKey
public java.lang.String getAlgorithm()
getAlgorithm
in interface java.security.Key
public int getStrength()
public PK11PubKey getPublicKey()
public static PK11PrivKey fromPrivateKeyInfo(java.security.spec.PKCS8EncodedKeySpec spec, CryptoToken token) throws TokenException
TokenException
public static PK11PrivKey fromPrivateKeyInfo(byte[] pki, CryptoToken token) throws TokenException
TokenException
public static PK11PrivKey fromPrivateKeyInfo(byte[] pki, CryptoToken token, byte[] publicValue) throws TokenException
publicValue
- An encoding of the public key, as used by the NSS
pk11wrap code. Don't use this unless you know what you're doing.TokenException
protected java.security.spec.DSAParameterSpec getDSAParams() throws TokenException
TokenException
public byte[] getEncoded()
getEncoded
in interface java.security.Key
public java.lang.String getFormat()
getFormat
in interface java.security.Key
public void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception