**javacard.security** 
 ====Interface RSAPrivateCrtKey  ====
**All Superinterfaces:** [[javacard:java-card-api:Key|Key]] , [[javacard:java-card-api:PrivateKey|PrivateKey]]  
 
 ----
  *[[javacard:java-card-api:privatekey|PrivateKey]] \\ 
The RSAPrivateCrtKey interface is used to sign data using the RSA algorithm
 in its Chinese Remainder Theorem form. It may also be used by the javacardx.crypto.Cipher class
 to encrypt/decrypt messages.
 
 Let 
  *S
 \\  = 
  *m
 \\ 
  *d
 \\  mod 
  *n
 \\ ,
 where 
  *m
 \\  is the data to be signed, 
  *d
 \\  is the private key exponent,
 and 
  *n
 \\  is private key modulus composed of
 two prime numbers 
  *p
 \\  and 
  *q
 \\ .
 The following names are used in the initializer methods in this interface:
 
 \\ 
 
  *P, the prime factor 
  *p
 \\ 
 \\ 
 
  *Q, the prime factor 
  *q
 \\ 
 \\ 
 
  *PQ = 
  *q
 \\ -1 mod 
  *p
 \\ 
 \\ 
 
  *DP1 = 
  *d
 \\  mod (
  *p
 \\  - 1)
 \\ 
 
  *DQ1 = 
  *d
 \\  mod (
  *q
 \\  - 1)
 \\ 
  
 When all five components (P,Q,PQ,DP1,DQ1) of the key are set, the key is
 initialized and ready for use.
**See Also:**[[javacard:java-card-api:RSAPrivateKey|RSAPrivateKey]] , 
[[javacard:java-card-api:RSAPublicKey|RSAPublicKey]] , 
[[javacard:java-card-api:KeyBuilder|KeyBuilder]] , 
[[javacard:java-card-api:Signature|Signature]] , 
[[javacard:java-card-api:Cipher|javacardx.crypto.Cipher]] , 
[[javacard:java-card-api:KeyEncryption|javacardx.crypto.KeyEncryption]]  
 
 ----
^ Method Summary ^^ 
| ** short** | **[[javacard:java-card-api:RSAPrivateCrtKey#getDP1(byte[], short)|getDP1]] **(byte[] buffer,short offset)          Returns the value of the DP1 parameter in plain text. |
| ** short** | **[[javacard:java-card-api:RSAPrivateCrtKey#getDQ1(byte[], short)|getDQ1]] **(byte[] buffer,short offset)          Returns the value of the DQ1 parameter in plain text. |
| ** short** | **[[javacard:java-card-api:RSAPrivateCrtKey#getP(byte[], short)|getP]] **(byte[] buffer,short offset)          Returns the value of the P parameter in plain text. |
| ** short** | **[[javacard:java-card-api:RSAPrivateCrtKey#getPQ(byte[], short)|getPQ]] **(byte[] buffer,short offset)          Returns the value of the PQ parameter in plain text. |
| ** short** | **[[javacard:java-card-api:RSAPrivateCrtKey#getQ(byte[], short)|getQ]] **(byte[] buffer,short offset)          Returns the value of the Q parameter in plain text. |
| ** void** | **[[javacard:java-card-api:RSAPrivateCrtKey#setDP1(byte[], short, short)|setDP1]] **(byte[] buffer,short offset,short length)          Sets the value of the DP1 parameter. |
| ** void** | **[[javacard:java-card-api:RSAPrivateCrtKey#setDQ1(byte[], short, short)|setDQ1]] **(byte[] buffer,short offset,short length)          Sets the value of the DQ1 parameter. |
| ** void** | **[[javacard:java-card-api:RSAPrivateCrtKey#setP(byte[], short, short)|setP]] **(byte[] buffer,short offset,short length)          Sets the value of the P parameter. |
| ** void** | **[[javacard:java-card-api:RSAPrivateCrtKey#setPQ(byte[], short, short)|setPQ]] **(byte[] buffer,short offset,short length)          Sets the value of the PQ parameter. |
| ** void** | **[[javacard:java-card-api:RSAPrivateCrtKey#setQ(byte[], short, short)|setQ]] **(byte[] buffer,short offset,short length)          Sets the value of the Q parameter. |
 
^ Methods inherited from interface javacard.security.Key ^ 
| [[javacard:java-card-api:Key#clearKey()|clearKey]] , [[javacard:java-card-api:Key#getSize()|getSize]] , [[javacard:java-card-api:Key#getType()|getType]] , [[javacard:java-card-api:Key#isInitialized()|isInitialized]]  |
 
^ Method Detail ^ 
 === setP === 
void **setP**(byte[] buffer,
short offset,
short length)
throws [[javacard:java-card-api:CryptoException|CryptoException]] 
Sets the value of the P parameter.
 The plain text data format is big-endian and right-aligned (the least significant bit is the least significant
 bit of last byte). Input P parameter data is copied into the internal representation.
 Note:
 \\ 
 
  *//If the key object implements the //javacardx.crypto.KeyEncryption// interface and the //Cipher// object specified via //setKeyCipher()// is not //null//, the P parameter value is decrypted using the //Cipher// object.// 
 \\  
 
 
 
 
**Parameters:**buffer - the input buffer 
 
offset - the offset into the input buffer at which the parameter value begins 
 
length - the length of the parameter
 
 
**Throws:**
[[javacard:java-card-api:CryptoException|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. 
 \\   
 
 
 
 ----
 === setQ === 
void **setQ**(byte[] buffer,
short offset,
short length)
throws [[javacard:java-card-api:CryptoException|CryptoException]] 
Sets the value of the Q parameter.
 The plain text data format is big-endian and right-aligned (the least significant bit is the least significant
 bit of last byte). Input Q parameter data is copied into the internal representation.
 Note:
 \\ 
 
  *//If the key object implements the //javacardx.crypto.KeyEncryption// interface and the //Cipher// object specified via //setKeyCipher()// is not //null//, the Q parameter value is decrypted using the //Cipher// object.// 
 \\  
 
 
 
 
**Parameters:**buffer - the input buffer 
 
offset - the offset into the input buffer at which the parameter value begins 
 
length - the length of the parameter
 
 
**Throws:**
[[javacard:java-card-api:CryptoException|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. 
 \\   
 
 
 
 ----
 === setDP1 === 
void **setDP1**(byte[] buffer,
short offset,
short length)
throws [[javacard:java-card-api:CryptoException|CryptoException]] 
Sets the value of the DP1 parameter.
 The plain text data format is big-endian and right-aligned (the least significant bit is the least significant
 bit of last byte). Input DP1 parameter data is copied into the internal representation.
 Note:
 \\ 
 
  *//If the key object implements the //javacardx.crypto.KeyEncryption// interface and the //Cipher// object specified via //setKeyCipher()// is not //null//, the DP1 parameter value is decrypted using the //Cipher// object.// 
 \\  
 
 
 
 
**Parameters:**buffer - the input buffer 
 
offset - the offset into the input buffer at which the parameter value begins 
 
length - the length of the parameter
 
 
**Throws:**
[[javacard:java-card-api:CryptoException|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. 
 \\   
 
 
 
 ----
 === setDQ1 === 
void **setDQ1**(byte[] buffer,
short offset,
short length)
throws [[javacard:java-card-api:CryptoException|CryptoException]] 
Sets the value of the DQ1 parameter.
 The plain text data format is big-endian and right-aligned (the least significant bit is the least significant
 bit of last byte). Input DQ1 parameter data is copied into the internal representation.
 Note:
 \\ 
 
  *//If the key object implements the //javacardx.crypto.KeyEncryption// interface and the //Cipher// object specified via //setKeyCipher()// is not //null//, the DQ1 parameter value is decrypted using the //Cipher// object.// 
 \\  
 
 
 
 
**Parameters:**buffer - the input buffer 
 
offset - the offset into the input buffer at which the parameter value begins 
 
length - the length of the parameter
 
 
**Throws:**
[[javacard:java-card-api:CryptoException|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. 
 \\   
 
 
 
 ----
 === setPQ === 
void **setPQ**(byte[] buffer,
short offset,
short length)
throws [[javacard:java-card-api:CryptoException|CryptoException]] 
Sets the value of the PQ parameter.
 The plain text data format is big-endian and right-aligned (the least significant bit is the least significant
 bit of last byte). Input PQ parameter data is copied into the internal representation.
 Note:
 \\ 
 
  *//If the key object implements the //javacardx.crypto.KeyEncryption// interface and the //Cipher// object specified via //setKeyCipher()// is not //null//, the PQ parameter value is decrypted using the //Cipher// object.// 
 \\  
 
 
 
 
**Parameters:**buffer - the input buffer 
 
offset - the offset into the input buffer at which the parameter value begins 
 
length - the length of the parameter
 
 
**Throws:**
[[javacard:java-card-api:CryptoException|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. 
 \\   
 
 
 
 ----
 === getP === 
short **getP**(byte[] buffer,
short offset)
Returns the value of the P parameter in plain text.
 The data format is big-endian and right-aligned (the least significant bit is the least significant
 bit of last byte).
 
 
 
 
**Parameters:**buffer - the output buffer 
 
offset - the offset into the output buffer at which the parameter value begins
 
 
**Returns:**the byte length of the P parameter value returned
 
 
**Throws:**
[[javacard:java-card-api:CryptoException|CryptoException]]  - with the following reason code:
 \\ 
 
  *CryptoException.UNINITIALIZED_KEY if the value of P parameter has not been successfully initialized since the time the initialized state of the key was set to false. 
 \\   
 
**See Also:**[[javacard:java-card-api:Key|Key]]  
 
 
 
 ----
 === getQ === 
short **getQ**(byte[] buffer,
short offset)
Returns the value of the Q parameter in plain text.
 The data format is big-endian and right-aligned (the least significant bit is the least significant
 bit of last byte).
 
 
 
 
**Parameters:**buffer - the output buffer 
 
offset - the offset into the output buffer at which the parameter value begins
 
 
**Returns:**the byte length of the Q parameter value returned
 
 
**Throws:**
[[javacard:java-card-api:CryptoException|CryptoException]]  - with the following reason code:
 \\ 
 
  *CryptoException.UNINITIALIZED_KEY if the value of Q parameter has not been successfully initialized since the time the initialized state of the key was set to false. 
 \\   
 
**See Also:**[[javacard:java-card-api:Key|Key]]  
 
 
 
 ----
 === getDP1 === 
short **getDP1**(byte[] buffer,
short offset)
Returns the value of the DP1 parameter in plain text.
 The data format is big-endian and right-aligned (the least significant bit is the least significant
 bit of last byte).
 
 
 
 
**Parameters:**buffer - the output buffer 
 
offset - the offset into the output buffer at which the parameter value begins
 
 
**Returns:**the byte length of the DP1 parameter value returned
 
 
**Throws:**
[[javacard:java-card-api:CryptoException|CryptoException]]  - with the following reason code:
 \\ 
 
  *CryptoException.UNINITIALIZED_KEY if the value of DP1 parameter has not been successfully initialized since the time the initialized state of the key was set to false. 
 \\   
 
**See Also:**[[javacard:java-card-api:Key|Key]]  
 
 
 
 ----
 === getDQ1 === 
short **getDQ1**(byte[] buffer,
short offset)
Returns the value of the DQ1 parameter in plain text.
 The data format is big-endian and right-aligned (the least significant bit is the least significant
 bit of last byte).
 
 
 
 
**Parameters:**buffer - the output buffer 
 
offset - the offset into the output buffer at which the parameter value begins
 
 
**Returns:**the byte length of the DQ1 parameter value returned
 
 
**Throws:**
[[javacard:java-card-api:CryptoException|CryptoException]]  - with the following reason code:
 \\ 
 
  *CryptoException.UNINITIALIZED_KEY if the value of DQ1 parameter has not been successfully initialized since the time the initialized state of the key was set to false. 
 \\   
 
**See Also:**[[javacard:java-card-api:Key|Key]]  
 
 
 
 ----
 === getPQ === 
short **getPQ**(byte[] buffer,
short offset)
Returns the value of the PQ parameter in plain text.
 The data format is big-endian and right-aligned (the least significant bit is the least significant
 bit of last byte).
 
 
 
 
**Parameters:**buffer - the output buffer 
 
offset - the offset into the output buffer at which the parameter value begins
 
 
**Returns:**the byte length of the PQ parameter value returned
 
 
**Throws:**
[[javacard:java-card-api:CryptoException|CryptoException]]  - with the following reason code:
 \\ 
 
  *CryptoException.UNINITIALIZED_KEY if the value of PQ parameter has not been successfully initialized since the time the initialized state of the key was set to false. 
 \\   
 
**See Also:**[[javacard:java-card-api:Key|Key]]