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

## com.licel.jcardsim.crypto
Class ECPrivateKeyImpl

    java.lang.Object
      com.licel.jcardsim.crypto.KeyImpl
          com.licel.jcardsim.crypto.ECKeyImpl
              com.licel.jcardsim.crypto.ECPrivateKeyImpl

All Implemented Interfaces:
  KeyWithParameters, ECKey, ECPrivateKey, Key, PrivateKey

    public class ECPrivateKeyImpl

extends ECKeyImpl
implements ECPrivateKey

Implementation `ECPrivateKey` based on BouncyCastle CryptoAPI

See Also:
  `ECPrivateKey`, `ECPrivateKeyParameters`

Field Summary
`protected ByteContainer` | `s`

Fields inherited from class com.licel.jcardsim.crypto.ECKeyImpl
`a, b, e1, e2, e3, fp, g, isKInitialized, k, r`

Fields inherited from class com.licel.jcardsim.crypto.KeyImpl
`size, type`

Constructor Summary
`ECPrivateKeyImpl(byte keyType, short keySize)` Construct not-initialized ecc private key
`ECPrivateKeyImpl(org.bouncycastle.crypto.params.ECPrivateKeyParameters params)` Construct and initialize ecc key with ECPrivateKeyParameters.

Method Summary
`void` | `clearKey()` Clears the key and sets its initialized state to false.
`org.bouncycastle.crypto.CipherParameters` | `getParameters()` Get `ECPrivateKeyParameters`
`short` | `getS(byte[] buffer, short offset)` Returns the value of the secret key in plaintext form.
`boolean` | `isInitialized()` Reports the initialized state of the key.
`void` | `setS(byte[] buffer, short offset, short length)` Sets the value of the secret key.

Methods inherited from class com.licel.jcardsim.crypto.ECKeyImpl
`getA, getB, getDomainParameters, getField, getG, getK, getKeyGenerationParameters, getR, setA, setB, setFieldF2M, setFieldF2M, setFieldFP, setG, setK, setR`

Methods inherited from class com.licel.jcardsim.crypto.KeyImpl
`getSize, getType`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

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

Field Detail

### s

    protected ByteContainer s

Constructor Detail

### ECPrivateKeyImpl

    public ECPrivateKeyImpl(byte keyType,
                            short keySize)

  Construct not-initialized ecc private key

  Parameters:
    `size` - key size it bits
  See Also:
    `KeyBuilder`

### ECPrivateKeyImpl

    public ECPrivateKeyImpl(org.bouncycastle.crypto.params.ECPrivateKeyParameters params)

  Construct and initialize ecc key with ECPrivateKeyParameters. Use in KeyPairImpl

  Parameters:
    `params` - key params from BouncyCastle API
  See Also:
    `KeyPair`, `ECPrivateKeyParameters`

Method Detail

### setS

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

  Description copied from interface: `ECPrivateKey`
  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.

  Specified by:
    `setS` in interface `ECPrivateKey`
  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

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

  Description copied from interface: `ECPrivateKey`
  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).

  Specified by:
    `getS` in interface `ECPrivateKey`
  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`

### isInitialized

    public boolean isInitialized()

  Description copied from interface: `Key`
  Reports the initialized state of the key. Keys must be initialized before being used.

  A `Key` object sets its initialized state to true only when all the associated `Key` object parameters have been set at least once since the time the initialized state was set to false.

  A newly created `Key` object sets its initialized state to false. Invocation of the `clearKey()` method sets the initialized state to false. A key with transient key data sets its initialized state to false on the associated clear events.

  Specified by:
    `isInitialized` in interface `Key`
  Overrides:
    `isInitialized` in class `ECKeyImpl`
  Returns:
    `true` if the key has been initialized

### clearKey

    public void clearKey()

  Description copied from interface: `Key`
  Clears the key and sets its initialized state to false.

  Specified by:
    `clearKey` in interface `Key`
  Overrides:
    `clearKey` in class `ECKeyImpl`

### getParameters

    public org.bouncycastle.crypto.CipherParameters getParameters()

  Get `ECPrivateKeyParameters`

  Specified by:
    `getParameters` in interface `KeyWithParameters`
  Returns:
    parameters for use with BouncyCastle API
  See Also:
    `ECPrivateKeyParameters`

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