**javacard.security** ====Interface DSAKey ==== **All Known Subinterfaces:** [[javacard:java-card-api:DSAPrivateKey|DSAPrivateKey]] , [[javacard:java-card-api:DSAPublicKey|DSAPublicKey]] ---- The DSAKey interface is the base interface for the DSA algorithm's private and public key implementations. A DSA private key implementation must also implement the DSAPrivateKey interface methods. A DSA public key implementation must also implement the DSAPublicKey interface methods. When all four components of the key (X or Y,P,Q,G) are set, the key is initialized and ready for use. **See Also:**[[javacard:java-card-api:DSAPublicKey|DSAPublicKey]] , [[javacard:java-card-api:DSAPrivateKey|DSAPrivateKey]] , [[javacard:java-card-api:KeyBuilder|KeyBuilder]] , [[javacard:java-card-api:Signature|Signature]] , [[javacard:java-card-api:KeyEncryption|javacardx.crypto.KeyEncryption]] ---- ^ Method Summary ^^ | ** short** | **[[javacard:java-card-api:DSAKey#getG(byte[], short)|getG]] **(byte[] buffer,short offset)          Returns the base parameter value of the key in plain text. | | ** short** | **[[javacard:java-card-api:DSAKey#getP(byte[], short)|getP]] **(byte[] buffer,short offset)          Returns the prime parameter value of the key in plain text. | | ** short** | **[[javacard:java-card-api:DSAKey#getQ(byte[], short)|getQ]] **(byte[] buffer,short offset)          Returns the subprime parameter value of the key in plain text. | | ** void** | **[[javacard:java-card-api:DSAKey#setG(byte[], short, short)|setG]] **(byte[] buffer,short offset,short length)          Sets the base parameter value of the key. | | ** void** | **[[javacard:java-card-api:DSAKey#setP(byte[], short, short)|setP]] **(byte[] buffer,short offset,short length)          Sets the prime parameter value of the key. | | ** void** | **[[javacard:java-card-api:DSAKey#setQ(byte[], short, short)|setQ]] **(byte[] buffer,short offset,short length)          Sets the subprime parameter value of the key. |   ^ Method Detail ^ === setP === void **setP**(byte[] buffer, short offset, short length) throws [[javacard:java-card-api:CryptoException|CryptoException]] Sets the prime parameter value of the key. The plain text data format is big-endian and right-aligned (the least significant bit is the least significant bit of last byte). Input prime 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 prime parameter value is decrypted using the //Cipher// object.// \\ **Parameters:**buffer - the input buffer offset - the offset into the input buffer at which the prime parameter value begins length - the length of the prime parameter value **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 subprime parameter value of the key. The plain text data format is big-endian and right-aligned (the least significant bit is the least significant bit of last byte). Input subprime 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 subprime parameter value is decrypted using the //Cipher// object.// \\ **Parameters:**buffer - the input buffer offset - the offset into the input buffer at which the subprime parameter value begins length - the length of the subprime parameter value **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. \\ ---- === setG === void **setG**(byte[] buffer, short offset, short length) throws [[javacard:java-card-api:CryptoException|CryptoException]] Sets the base parameter value of the key. The plain text data format is big-endian and right-aligned (the least significant bit is the least significant bit of last byte). Input base 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 base parameter value is decrypted using the //Cipher// object.// \\ **Parameters:**buffer - the input buffer offset - the offset into the input buffer at which the base parameter value begins length - the length of the base parameter value **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 prime parameter value of the key 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 prime parameter value starts **Returns:**the byte length of the prime parameter value returned **Throws:** [[javacard:java-card-api:CryptoException|CryptoException]] - with the following reason code: \\ *CryptoException.UNINITIALIZED_KEY if the prime 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 subprime parameter value of the key 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 subprime parameter value begins **Returns:**the byte length of the subprime parameter value returned **Throws:** [[javacard:java-card-api:CryptoException|CryptoException]] - with the following reason code: \\ *CryptoException.UNINITIALIZED_KEY if the subprime 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]] ---- === getG === short **getG**(byte[] buffer, short offset) Returns the base parameter value of the key 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 base parameter value begins **Returns:**the byte length of the base parameter value returned **Throws:** [[javacard:java-card-api:CryptoException|CryptoException]] - with the following reason code: \\ *CryptoException.UNINITIALIZED_KEY if the base 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]]