com.upek.android.ptapi.rsa
Class RSAPrivateCrtKey

java.lang.Object
  extended by com.upek.android.ptapi.rsa.RSAPrivateCrtKey
All Implemented Interfaces:
java.io.Serializable, java.security.interfaces.RSAKey, java.security.interfaces.RSAPrivateCrtKey, java.security.interfaces.RSAPrivateKey, java.security.Key, java.security.PrivateKey

public class RSAPrivateCrtKey
extends java.lang.Object
implements java.security.interfaces.RSAPrivateCrtKey, java.io.Serializable

This class represents a private RSA key with full information, which can be imported and exported to TFM native representation. It implements java.security.interfaces.RSAPrivateCrtKey interface, so it can be used directly with RSA implementation from Java Cryptography Extension. Export and import from java.security.spec.RSAPrivateCrtKeySpec is supported too.

The native TFM representation is returned by getEncoded().

See Also:
Serialized Form

Constructor Summary
RSAPrivateCrtKey(byte[] ptApiData)
          Creates a new key from TFM internal format.
RSAPrivateCrtKey(java.security.interfaces.RSAPrivateCrtKey key)
          Creates a new key from another class implementing RSAPrivateCrtKey.
RSAPrivateCrtKey(java.security.spec.RSAPrivateCrtKeySpec keySpec)
          Creates a new key from RSAPrivateCrtKeySpec key specifiction.
 
Method Summary
 java.lang.String getAlgorithm()
           
 int getBitLegth()
          Returns a bit length of this key.
 java.math.BigInteger getCrtCoefficient()
           
 byte[] getEncoded()
           
 java.lang.String getFormat()
           
 java.security.spec.RSAPrivateCrtKeySpec getKeySpec()
          Exports this key in a new RSAPrivateCrtKeySpec object.
 java.math.BigInteger getModulus()
           
 java.math.BigInteger getPrimeExponentP()
           
 java.math.BigInteger getPrimeExponentQ()
           
 java.math.BigInteger getPrimeP()
           
 java.math.BigInteger getPrimeQ()
           
 java.math.BigInteger getPrivateExponent()
           
 java.math.BigInteger getPublicExponent()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSAPrivateCrtKey

public RSAPrivateCrtKey(byte[] ptApiData)
                 throws PtException
Creates a new key from TFM internal format. There must be present a private key with full information in the buffer.

Parameters:
ptApiData - contains key in native TFM RSA key representation
Throws:
PtException - whether buffer has invalid structure

RSAPrivateCrtKey

public RSAPrivateCrtKey(java.security.interfaces.RSAPrivateCrtKey key)
Creates a new key from another class implementing RSAPrivateCrtKey.

Parameters:
key - is the source key to copy

RSAPrivateCrtKey

public RSAPrivateCrtKey(java.security.spec.RSAPrivateCrtKeySpec keySpec)
Creates a new key from RSAPrivateCrtKeySpec key specifiction.

Parameters:
keySpec - is the source key specification
Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Specified by:
getAlgorithm in interface java.security.Key

getBitLegth

public int getBitLegth()
Returns a bit length of this key.

Returns:
a key bit length

getCrtCoefficient

public java.math.BigInteger getCrtCoefficient()
Specified by:
getCrtCoefficient in interface java.security.interfaces.RSAPrivateCrtKey

getEncoded

public byte[] getEncoded()
Specified by:
getEncoded in interface java.security.Key

getFormat

public java.lang.String getFormat()
Specified by:
getFormat in interface java.security.Key

getKeySpec

public java.security.spec.RSAPrivateCrtKeySpec getKeySpec()
Exports this key in a new RSAPrivateCrtKeySpec object.

Returns:
new key specification

getModulus

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

getPrimeExponentP

public java.math.BigInteger getPrimeExponentP()
Specified by:
getPrimeExponentP in interface java.security.interfaces.RSAPrivateCrtKey

getPrimeExponentQ

public java.math.BigInteger getPrimeExponentQ()
Specified by:
getPrimeExponentQ in interface java.security.interfaces.RSAPrivateCrtKey

getPrimeP

public java.math.BigInteger getPrimeP()
Specified by:
getPrimeP in interface java.security.interfaces.RSAPrivateCrtKey

getPrimeQ

public java.math.BigInteger getPrimeQ()
Specified by:
getPrimeQ in interface java.security.interfaces.RSAPrivateCrtKey

getPrivateExponent

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

getPublicExponent

public java.math.BigInteger getPublicExponent()
Specified by:
getPublicExponent in interface java.security.interfaces.RSAPrivateCrtKey