Interface ECPrivateKey
- All Superinterfaces:
ECKey, Key, PrivateKey
The
ECPrivateKey interface is used to generate signatures on
data using the ECDSA (Elliptic Curve Digital Signature Algorithm) and to
generate shared secrets using the ECDH (Elliptic Curve Diffie-Hellman)
algorithm. An implementation of ECPrivateKey interface must
also implement the ECKey interface methods.
When all components of the key (S, A, B, G, R, Field) are set, the key is
initialized and ready for use. In addition, the KeyAgreement
algorithm type ALG_EC_SVDP_DHC requires that the cofactor, K,
be initialized.
The notation used to describe parameters specific to the EC algorithm is based on the naming conventions established in [IEEE P1363].
- See Also:
-
Method Summary
Methods inherited from interface ECKey
copyDomainParametersFrom, getA, getB, getField, getG, getK, getR, setA, setB, setFieldF2M, setFieldF2M, setFieldFP, setG, setK, setRModifier and TypeMethodDescriptionvoidcopyDomainParametersFrom(ECKey ecKey) Copies the domain parameters from the specifiedECKeyinstance into the domain parameters ofthisobject instance.shortgetA(byte[] buffer, short offset) Returns the first coefficient of the curve of the key.shortgetB(byte[] buffer, short offset) Returns the second coefficient of the curve of the key.shortgetField(byte[] buffer, short offset) Returns the field specification parameter value of the key.shortgetG(byte[] buffer, short offset) Returns the fixed point of the curve.shortgetK()Returns the cofactor of the order of the fixed point G of the curve.shortgetR(byte[] buffer, short offset) Returns the order of the fixed point G of the curve.voidsetA(byte[] buffer, short offset, short length) Sets the first coefficient of the curve of the key.voidsetB(byte[] buffer, short offset, short length) Sets the second coefficient of the curve of the key.voidsetFieldF2M(short e) Sets the field specification parameter value for keys of typeTYPE_EC_F2M_PUBLICorTYPE_EC_F2M_PRIVATEin the case where the polynomial is a trinomial, of the form x^n + x^e + 1 (where n is the bit length of the key).voidsetFieldF2M(short e1, short e2, short e3) Sets the field specification parameter value for keys of typeTYPE_EC_F2M_PUBLICorTYPE_EC_F2M_PRIVATEin the case where the polynomial is a pentanomial, of the form x^n + x^e1 + x^e2 + x^e3 + 1 (where n is the bit length of the key).voidsetFieldFP(byte[] buffer, short offset, short length) Sets the field specification parameter value for keys of typeTYPE_EC_FP_PRIVATEorTYPE_EC_FP_PUBLIC.voidsetG(byte[] buffer, short offset, short length) Sets the fixed point of the curve.voidsetK(short K) Sets the cofactor of the order of the fixed point G of the curve.voidsetR(byte[] buffer, short offset, short length) Sets the order of the fixed point G of the curve.Methods inherited from interface Key
clearKey, getSize, getType, isInitialized
-
Method Details
-
setS
Sets the value of the secret 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 parameter data is copied into the internal representation.Note:
- If the key object implements the
javacardx.crypto.KeyEncryptioninterface and theCipherobject specified viasetKeyCipher()is notnull, the key value is decrypted using theCipherobject.
- Parameters:
buffer- the input bufferoffset- the offset into the input buffer at which the secret value is to beginlength- the byte length of the secret value- Throws:
CryptoException- with the following reason code:CryptoException.ILLEGAL_VALUEif the length parameter is 0 or invalid or the input key data is inconsistent with the key length or if input data decryption is required and fails.
- If the key object implements the
-
getS
Returns the value of the secret key in plaintext form. 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 bufferoffset- the offset into the input buffer at which the secret value is to begin- Returns:
- the byte length of the secret value
- Throws:
CryptoException- with the following reason code:CryptoException.UNINITIALIZED_KEYif the value of the secret key has not been successfully initialized since the time the initialized state of the key was set to false.
- See Also:
-