**javacard.security** ====Interface DSAPrivateKey ==== **All Superinterfaces:** [[javacard:java-card-api:DSAKey|DSAKey]] , [[javacard:java-card-api:Key|Key]] , [[javacard:java-card-api:PrivateKey|PrivateKey]] ---- *[[javacard:java-card-api:privatekey|PrivateKey]] \\ *[[javacard:java-card-api:dsakey|DSAKey]] \\ The DSAPrivateKey interface is used to sign data using the DSA algorithm. An implementation of DSAPrivateKey interface must also implement the DSAKey interface methods. When all four components of the key (X,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:KeyBuilder|KeyBuilder]] , [[javacard:java-card-api:Signature|Signature]] , [[javacard:java-card-api:KeyEncryption|javacardx.crypto.KeyEncryption]] ---- ^ Method Summary ^^ | ** short** | **[[javacard:java-card-api:DSAPrivateKey#getX(byte[], short)|getX]] **(byte[] buffer,short offset)          Returns the value of the key in plain text. | | ** void** | **[[javacard:java-card-api:DSAPrivateKey#setX(byte[], short, short)|setX]] **(byte[] buffer,short offset,short length)          Sets the value of the key. |   ^ 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]] |   ^ Methods inherited from interface javacard.security.DSAKey ^ | [[javacard:java-card-api:DSAKey#getG(byte[], short)|getG]] , [[javacard:java-card-api:DSAKey#getP(byte[], short)|getP]] , [[javacard:java-card-api:DSAKey#getQ(byte[], short)|getQ]] , [[javacard:java-card-api:DSAKey#setG(byte[], short, short)|setG]] , [[javacard:java-card-api:DSAKey#setP(byte[], short, short)|setP]] , [[javacard:java-card-api:DSAKey#setQ(byte[], short, short)|setQ]] |   ^ Method Detail ^ === setX === void **setX**(byte[] buffer, short offset, short length) throws [[javacard:java-card-api:CryptoException|CryptoException]] Sets the value of the key. When the base, prime and subprime parameters are initialized and the key value is set, the key is ready for use. The plain text data format is big-endian and right-aligned (the least significant bit is the least significant bit of last byte). Input key 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 key value is decrypted using the //Cipher// object.// \\ **Parameters:**buffer - the input buffer offset - the offset into the input buffer at which the modulus value begins length - the length of the modulus **Throws:** [[javacard:java-card-api:CryptoException|CryptoException]] - with the following reason code: \\ *CryptoException.ILLEGAL_VALUE if the input key data length is inconsistent with the implementation or if input data decryption is required and fails. \\ ---- === getX === short **getX**(byte[] buffer, short offset) Returns the 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 key value starts **Returns:**the byte length of the key value returned **Throws:** [[javacard:java-card-api:CryptoException|CryptoException]] - with the following reason code: \\ *CryptoException.UNINITIALIZED_KEY if the value of the key 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]]