JSS 3.2

org.mozilla.jss.pkcs11
Class PK11PrivKey

java.lang.Object
  |
  +--org.mozilla.jss.pkcs11.PK11Key
        |
        +--org.mozilla.jss.pkcs11.PK11PrivKey
All Implemented Interfaces:
java.security.Key, java.security.PrivateKey, PrivateKey, java.io.Serializable
Direct Known Subclasses:
PK11DSAPrivateKey, PK11RSAPrivateKey

public class PK11PrivKey
extends PK11Key
implements PrivateKey

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.mozilla.jss.crypto.PrivateKey
PrivateKey.Type
 
Field Summary
protected  KeyProxy keyProxy
           
 
Fields inherited from interface org.mozilla.jss.crypto.PrivateKey
DiffieHellman, DSA, RSA
 
Fields inherited from interface java.security.PrivateKey
serialVersionUID
 
Constructor Summary
private PK11PrivKey()
           
protected PK11PrivKey(byte[] pointer)
           
 
Method Summary
static PK11PrivKey fromPrivateKeyInfo(byte[] pki, CryptoToken token)
          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()
           
private  byte[][] getDSAParamsNative()
           
 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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Key
getAlgorithm, getEncoded, getFormat
 

Field Detail

keyProxy

protected KeyProxy keyProxy
Constructor Detail

PK11PrivKey

private PK11PrivKey()

PK11PrivKey

protected PK11PrivKey(byte[] pointer)
Method Detail

verifyKeyIsOnToken

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

NoSuchItemOnTokenException

getOwningToken

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

Specified by:
getOwningToken in interface PrivateKey
Returns:
The PK11Token that owns this key.

getUniqueID

public byte[] getUniqueID()
                   throws TokenException
Description copied from interface: PrivateKey
Returns the unique ID of this key. Unique IDs can be used to match certificates to keys.

Specified by:
getUniqueID in interface PrivateKey
TokenException
See Also:
TokenCertificate.getUniqueID()

getKeyType

public KeyType getKeyType()

getType

public PrivateKey.Type getType()
Description copied from interface: PrivateKey
Returns the type (RSA or DSA) of this private key.

Specified by:
getType in interface PrivateKey

getStrength

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

Specified by:
getStrength in interface PrivateKey

fromPrivateKeyInfo

public static PK11PrivKey fromPrivateKeyInfo(java.security.spec.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.


getDSAParams

protected java.security.spec.DSAParameterSpec getDSAParams()
                                                    throws TokenException
TokenException

getDSAParamsNative

private byte[][] getDSAParamsNative()
                             throws TokenException
TokenException

getAlgorithm

public java.lang.String getAlgorithm()

getEncoded

public byte[] getEncoded()
Subclasses that support encoding can overload this method.


getFormat

public java.lang.String getFormat()
Subclasses that support encoding can overload this method.


JSS 3.2