org.hardtokenmgmt.core.token
Class TokenPrivateKey

java.lang.Object
  extended by org.hardtokenmgmt.core.token.TokenPrivateKey
All Implemented Interfaces:
java.io.Serializable, java.security.interfaces.RSAKey, java.security.interfaces.RSAPrivateKey, java.security.Key, java.security.PrivateKey

public class TokenPrivateKey
extends java.lang.Object
implements java.security.interfaces.RSAPrivateKey

This is an adapter class that allows to use token keys as JCA private keys. An application can use this class whereever an interface requires the application to pass an JCA private key; e.g. for signing.

Version:
0.1
Author:
Karl Scheibelhofer
See Also:
Serialized Form

Field Summary
protected  iaik.pkcs.pkcs11.objects.PrivateKey tokenPrivateKey_
          The PKCS#11 private key of this object.
 
Constructor Summary
TokenPrivateKey(iaik.pkcs.pkcs11.objects.PrivateKey tokenPrivateKey)
          Create a new JCA private key that uses the given PKCS#11 private key internally.
 
Method Summary
 java.lang.String getAlgorithm()
          Just returns null.
 byte[] getEncoded()
          Just returns null.
 java.lang.String getFormat()
          Just returns null.
 java.math.BigInteger getModulus()
           
 java.math.BigInteger getPrivateExponent()
           
 iaik.pkcs.pkcs11.objects.PrivateKey getTokenPrivateKey()
          Returns the PKCS#11 private key object that this object refers to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokenPrivateKey_

protected iaik.pkcs.pkcs11.objects.PrivateKey tokenPrivateKey_
The PKCS#11 private key of this object.

Constructor Detail

TokenPrivateKey

public TokenPrivateKey(iaik.pkcs.pkcs11.objects.PrivateKey tokenPrivateKey)
Create a new JCA private key that uses the given PKCS#11 private key internally.

Parameters:
tokenPrivateKey - The PKCS#11 private key that this object refers to.
Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Just returns null.

Specified by:
getAlgorithm in interface java.security.Key
Returns:
null.

getFormat

public java.lang.String getFormat()
Just returns null.

Specified by:
getFormat in interface java.security.Key
Returns:
null.

getEncoded

public byte[] getEncoded()
Just returns null.

Specified by:
getEncoded in interface java.security.Key
Returns:
null.

getTokenPrivateKey

public iaik.pkcs.pkcs11.objects.PrivateKey getTokenPrivateKey()
Returns the PKCS#11 private key object that this object refers to.

Returns:
The KCS#11 private key object that this object refers to.

getPrivateExponent

public java.math.BigInteger getPrivateExponent()
Specified by:
getPrivateExponent in interface java.security.interfaces.RSAPrivateKey

getModulus

public java.math.BigInteger getModulus()
Specified by:
getModulus in interface java.security.interfaces.RSAKey