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 ECPublicKeyImpl

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

All Implemented Interfaces:
  KeyWithParameters, ECKey, ECPublicKey, Key, PublicKey

    public class ECPublicKeyImpl

extends ECKeyImpl
implements ECPublicKey

Implementation `ECPublicKey` based on BouncyCastle CryptoAPI

See Also:
  `ECPublicKey`, `ECPublicKeyParameters`

Field Summary
`protected ByteContainer` | `w`

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
`ECPublicKeyImpl(byte keyType, short keySize)` Construct not-initialized ecc public key
`ECPublicKeyImpl(org.bouncycastle.crypto.params.ECPublicKeyParameters params)` Construct and initialize ecc key with ECPublicKeyParameters.

Method Summary
`void` | `clearKey()` Clears the key and sets its initialized state to false.
`org.bouncycastle.crypto.CipherParameters` | `getParameters()` Get `ECPublicKeyParameters`
`short` | `getW(byte[] buffer, short offset)` Returns the point of the curve comprising the public key in plain text form.
`boolean` | `isInitialized()` Reports the initialized state of the key.
`void` | `setW(byte[] buffer, short offset, short length)` Sets the point of the curve comprising the public 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

### w

    protected ByteContainer w

Constructor Detail

### ECPublicKeyImpl

    public ECPublicKeyImpl(byte keyType,
                           short keySize)

  Construct not-initialized ecc public key

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

### ECPublicKeyImpl

    public ECPublicKeyImpl(org.bouncycastle.crypto.params.ECPublicKeyParameters params)

  Construct and initialize ecc key with ECPublicKeyParameters. Use in KeyPairImpl

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

Method Detail

### setW

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

  Description copied from interface: `ECPublicKey`
  Sets the point of the curve comprising the public key. The point should be specified as an octet string as per ANSI X9.62. A specific implementation need not support the compressed form, but must support the uncompressed form of the point. 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:
    `setW` in interface `ECPublicKey`
  Parameters:
    `buffer` - the input buffer
    `offset` - the offset into the input buffer at which the point specification begins
    `length` - the byte length of the point specification
  Throws:
    `CryptoException` - with the following reason code:
    - `CryptoException.ILLEGAL_VALUE` if the input parameter data format is incorrect, or if the input parameter data is inconsistent with the key length, or if input data decryption is required and fails.

### getW

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

  Description copied from interface: `ECPublicKey`
  Returns the point of the curve comprising the public key in plain text form. The point is represented as an octet string in compressed or uncompressed forms as per ANSI X9.62. The data format is big-endian and right-aligned (the least significant bit is the least significant bit of last byte).

  Specified by:
    `getW` in interface `ECPublicKey`
  Parameters:
    `buffer` - the output buffer
    `offset` - the offset into the output buffer at which the point specification data is to begin
  Returns:
    the byte length of the point specificiation
  Throws:
    `CryptoException` - with the following reason code:
    - `CryptoException.UNINITIALIZED_KEY` if the point of the curve comprising the public 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 `ECPublicKeyParameters`

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

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