org.mozilla.jss.pkcs11

Class PK11PrivKey

public class PK11PrivKey extends PK11Key implements PrivateKey

Constructor Summary
protected PK11PrivKey(byte[] pointer)
Method Summary
static PK11PrivKeyfromPrivateKeyInfo(PKCS8EncodedKeySpec spec, CryptoToken token)
Imports a PrivateKeyInfo, storing it as a temporary PrivateKey on the given token.
static PK11PrivKeyfromPrivateKeyInfo(byte[] pki, CryptoToken token)
Imports a PrivateKeyInfo, storing it as a temporary PrivateKey on the given token.
static PK11PrivKeyfromPrivateKeyInfo(byte[] pki, CryptoToken token, byte[] publicValue)
Imports a PrivateKeyInfo, storing it as a temporary PrivateKey on the given token.
StringgetAlgorithm()
protected DSAParameterSpecgetDSAParams()
KeyTypegetKeyType()
CryptoTokengetOwningToken()
Returns a new CryptoToken where this key resides.
intgetStrength()
Returns the size in bits of the modulus of an RSA Private key.
PrivateKey.TypegetType()
byte[]getUniqueID()
voidverifyKeyIsOnToken(PK11Token token)
Make sure this key lives on the given token.

Constructor Detail

PK11PrivKey

protected PK11PrivKey(byte[] pointer)

Method Detail

fromPrivateKeyInfo

public static PK11PrivKey fromPrivateKeyInfo(PKCS8EncodedKeySpec spec, CryptoToken token)
Imports a PrivateKeyInfo, storing it as a temporary PrivateKey on the given token. The key will be a temporary (session) key until it is imported into a KeyStore, at which point it will be made a permanent (token) object.

fromPrivateKeyInfo

public static PK11PrivKey fromPrivateKeyInfo(byte[] pki, CryptoToken token)
Imports a PrivateKeyInfo, storing it as a temporary PrivateKey on the given token. The key will be a temporary (session) key until it is imported into a KeyStore, at which point it will be made a permanent (token) object.

fromPrivateKeyInfo

public static PK11PrivKey fromPrivateKeyInfo(byte[] pki, CryptoToken token, byte[] publicValue)
Imports a PrivateKeyInfo, storing it as a temporary PrivateKey on the given token. The key will be a temporary (session) key until it is imported into a KeyStore, at which point it will be made a permanent (token) object.

Parameters: 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.

getAlgorithm

public String getAlgorithm()

getDSAParams

protected DSAParameterSpec getDSAParams()

getKeyType

public KeyType getKeyType()

getOwningToken

public CryptoToken getOwningToken()
Returns a new CryptoToken where this key resides.

Returns: The PK11Token that owns this key.

getStrength

public int getStrength()
Returns the size in bits of the modulus of an RSA Private key. Returns -1 for other types of keys.

getType

public PrivateKey.Type getType()

getUniqueID

public byte[] getUniqueID()

verifyKeyIsOnToken

public void verifyKeyIsOnToken(PK11Token token)
Make sure this key lives on the given token.