Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javacard.framework.security
Interface ECPrivateKey

All Superinterfaces:
  ECKey, Key, PrivateKey

All Known Implementing Classes:
  ECPrivateKeyImpl

    public interface ECPrivateKey

extends PrivateKey, ECKey

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:
  `ECPublicKey`, `KeyBuilder`, `Signature`, `KeyEncryption`, `KeyAgreement`

Method Summary
`short` | `getS(byte[] buffer, short offset)` Returns the value of the secret key in plaintext form.
`void` | `setS(byte[] buffer, short offset, short length)` Sets the value of the secret key.

Methods inherited from interface javacard.framework.security.Key
`clearKey, getSize, getType, isInitialized`

Methods inherited from interface javacard.framework.security.ECKey
`getA, getB, getField, getG, getK, getR, setA, setB, setFieldF2M, setFieldF2M, setFieldFP, setG, setK, setR`

Method Detail

### setS

    void setS(byte[] buffer,
              short offset,
              short length)
              throws CryptoException

  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.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 secret value is to begin
    `length` - the byte length of the secret value
  Throws:
    `CryptoException` - with the following reason code:
    - `CryptoException.ILLEGAL_VALUE` if the input key data is inconsistent with the key length or if input data decryption is required and fails.

### getS

    short getS(byte[] buffer,
               short offset)
               throws CryptoException

  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 buffer
    `offset` - 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_KEY` if 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:
    `Key`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD