|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.licel.jcardsim.crypto.KeyImpl com.licel.jcardsim.crypto.RSAKeyImpl com.licel.jcardsim.crypto.RSAPrivateCrtKeyImpl
public class RSAPrivateCrtKeyImpl
Implementation RSAPrivateCrtKey
based
on BouncyCastle CryptoAPI
RSAPrivateCrtKey
,
RSAPrivateCrtKeyParameters
Field Summary | |
---|---|
protected ByteContainer |
dp1
|
protected ByteContainer |
dq1
|
protected ByteContainer |
p
|
protected ByteContainer |
pq
|
protected ByteContainer |
publicExponent
|
protected ByteContainer |
q
|
Fields inherited from class com.licel.jcardsim.crypto.RSAKeyImpl |
---|
exponent, isPrivate, modulus |
Fields inherited from class com.licel.jcardsim.crypto.KeyImpl |
---|
size, type |
Constructor Summary | |
---|---|
RSAPrivateCrtKeyImpl(org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters params)
Construct and initialize rsa key with RSAPrivateCrtKeyParameters. |
|
RSAPrivateCrtKeyImpl(short keySize)
Construct not-initialized rsa private crt key |
Method Summary | |
---|---|
void |
clearKey()
Clears the key and sets its initialized state to false. |
short |
getDP1(byte[] buffer,
short offset)
Returns the value of the DP1 parameter in plain text. |
short |
getDQ1(byte[] buffer,
short offset)
Returns the value of the DQ1 parameter in plain text. |
short |
getP(byte[] buffer,
short offset)
Returns the value of the P parameter in plain text. |
org.bouncycastle.crypto.CipherParameters |
getParameters()
Get RSAKeyParameters |
short |
getPQ(byte[] buffer,
short offset)
Returns the value of the PQ parameter in plain text. |
short |
getQ(byte[] buffer,
short offset)
Returns the value of the Q parameter in plain text. |
boolean |
isInitialized()
Reports the initialized state of the key. |
void |
setDP1(byte[] buffer,
short offset,
short length)
Sets the value of the DP1 parameter. |
void |
setDQ1(byte[] buffer,
short offset,
short length)
Sets the value of the DQ1 parameter. |
void |
setP(byte[] buffer,
short offset,
short length)
Sets the value of the P parameter. |
void |
setPQ(byte[] buffer,
short offset,
short length)
Sets the value of the PQ parameter. |
void |
setPublicExponent(byte[] buffer,
short offset,
short length)
|
void |
setQ(byte[] buffer,
short offset,
short length)
Sets the value of the Q parameter. |
Methods inherited from class com.licel.jcardsim.crypto.RSAKeyImpl |
---|
getExponent, getKeyGenerationParameters, getModulus, setExponent, setModulus |
Methods inherited from class com.licel.jcardsim.crypto.KeyImpl |
---|
getSize, getType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javacard.security.Key |
---|
getSize, getType |
Field Detail |
---|
protected ByteContainer p
protected ByteContainer q
protected ByteContainer dp1
protected ByteContainer dq1
protected ByteContainer pq
protected ByteContainer publicExponent
Constructor Detail |
---|
public RSAPrivateCrtKeyImpl(short keySize)
size
- key size it bits (modulus size)KeyBuilder
public RSAPrivateCrtKeyImpl(org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters params)
params
- key params from BouncyCastle APIKeyPair
,
RSAPrivateCrtKeyParameters
Method Detail |
---|
public void setPublicExponent(byte[] buffer, short offset, short length) throws CryptoException
CryptoException
public void setP(byte[] buffer, short offset, short length) throws CryptoException
RSAPrivateCrtKey
Note:
javacardx.crypto.KeyEncryption
interface and the Cipher
object specified via setKeyCipher()
is not null
, the P parameter value is decrypted using the Cipher
object.
setP
in interface RSAPrivateCrtKey
buffer
- the input bufferoffset
- the offset into the input buffer at which the parameter value beginslength
- the length of the parameter
CryptoException
- with the following reason code:CryptoException.ILLEGAL_VALUE
if the input parameter data length is inconsistent
with the implementation or if input data decryption is required and fails.
public void setQ(byte[] buffer, short offset, short length) throws CryptoException
RSAPrivateCrtKey
Note:
javacardx.crypto.KeyEncryption
interface and the Cipher
object specified via setKeyCipher()
is not null
, the Q parameter value is decrypted using the Cipher
object.
setQ
in interface RSAPrivateCrtKey
buffer
- the input bufferoffset
- the offset into the input buffer at which the parameter value beginslength
- the length of the parameter
CryptoException
- with the following reason code:CryptoException.ILLEGAL_VALUE
if the input parameter data length is inconsistent
with the implementation or if input data decryption is required and fails.
public void setDP1(byte[] buffer, short offset, short length) throws CryptoException
RSAPrivateCrtKey
Note:
javacardx.crypto.KeyEncryption
interface and the Cipher
object specified via setKeyCipher()
is not null
, the DP1 parameter value is decrypted using the Cipher
object.
setDP1
in interface RSAPrivateCrtKey
buffer
- the input bufferoffset
- the offset into the input buffer at which the parameter value beginslength
- the length of the parameter
CryptoException
- with the following reason code:CryptoException.ILLEGAL_VALUE
if the input parameter data length is inconsistent
with the implementation or if input data decryption is required and fails.
public void setDQ1(byte[] buffer, short offset, short length) throws CryptoException
RSAPrivateCrtKey
Note:
javacardx.crypto.KeyEncryption
interface and the Cipher
object specified via setKeyCipher()
is not null
, the DQ1 parameter value is decrypted using the Cipher
object.
setDQ1
in interface RSAPrivateCrtKey
buffer
- the input bufferoffset
- the offset into the input buffer at which the parameter value beginslength
- the length of the parameter
CryptoException
- with the following reason code:CryptoException.ILLEGAL_VALUE
if the input parameter data length is inconsistent
with the implementation or if input data decryption is required and fails.
public void setPQ(byte[] buffer, short offset, short length) throws CryptoException
RSAPrivateCrtKey
Note:
javacardx.crypto.KeyEncryption
interface and the Cipher
object specified via setKeyCipher()
is not null
, the PQ parameter value is decrypted using the Cipher
object.
setPQ
in interface RSAPrivateCrtKey
buffer
- the input bufferoffset
- the offset into the input buffer at which the parameter value beginslength
- the length of the parameter
CryptoException
- with the following reason code:CryptoException.ILLEGAL_VALUE
if the input parameter data length is inconsistent
with the implementation or if input data decryption is required and fails.
public short getP(byte[] buffer, short offset)
RSAPrivateCrtKey
getP
in interface RSAPrivateCrtKey
buffer
- the output bufferoffset
- the offset into the output buffer at which the parameter value begins
Key
public short getQ(byte[] buffer, short offset)
RSAPrivateCrtKey
getQ
in interface RSAPrivateCrtKey
buffer
- the output bufferoffset
- the offset into the output buffer at which the parameter value begins
Key
public short getDP1(byte[] buffer, short offset)
RSAPrivateCrtKey
getDP1
in interface RSAPrivateCrtKey
buffer
- the output bufferoffset
- the offset into the output buffer at which the parameter value begins
Key
public short getDQ1(byte[] buffer, short offset)
RSAPrivateCrtKey
getDQ1
in interface RSAPrivateCrtKey
buffer
- the output bufferoffset
- the offset into the output buffer at which the parameter value begins
Key
public short getPQ(byte[] buffer, short offset)
RSAPrivateCrtKey
getPQ
in interface RSAPrivateCrtKey
buffer
- the output bufferoffset
- the offset into the output buffer at which the parameter value begins
Key
public void clearKey()
Key
clearKey
in interface Key
clearKey
in class RSAKeyImpl
public boolean isInitialized()
Key
A Key
object sets its initialized state to true only when all the associated
Key
object parameters have been set at least once since the time the initialized state was set to false.
A newly created Key
object sets its initialized state to false. Invocation of the
clearKey()
method sets the initialized state to false. A key with transient key data
sets its initialized state to false on the associated clear events.
isInitialized
in interface Key
isInitialized
in class RSAKeyImpl
true
if the key has been initializedpublic org.bouncycastle.crypto.CipherParameters getParameters()
RSAKeyImpl
RSAKeyParameters
getParameters
in interface KeyWithParameters
getParameters
in class RSAKeyImpl
RSAKeyParameters
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |