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 DSAKeyImpl

    java.lang.Object
      com.licel.jcardsim.crypto.KeyImpl
          com.licel.jcardsim.crypto.DSAKeyImpl

All Implemented Interfaces:
  KeyWithParameters, DSAKey, Key

Direct Known Subclasses:
  DSAPrivateKeyImpl, DSAPublicKeyImpl

    public class DSAKeyImpl

extends KeyImpl
implements DSAKey

Base class for `DSAPublicKeyImpl/DSAPrivateKeyImpl` on BouncyCastle CryptoAPI

See Also:
  `DSAKey`

Field Summary
`protected ByteContainer` | `g`
`protected boolean` | `isPrivate`
`protected ByteContainer` | `p`
`protected ByteContainer` | `q`

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

Constructor Summary
`DSAKeyImpl(byte keyType, short size)` Construct not-initialized dsa key
`DSAKeyImpl(org.bouncycastle.crypto.params.DSAKeyParameters params)` Construct and initialize dsa key with DSAKeyParameters.

Method Summary
`void` | `clearKey()` Clears the key and sets its initialized state to false.
`short` | `getG(byte[] buffer, short offset)` Returns the base parameter value of the key in plain text.
`org.bouncycastle.crypto.KeyGenerationParameters` | `getKeyGenerationParameters(SecureRandom rnd)` Get `DSAKeyGenerationParameters`
`short` | `getP(byte[] buffer, short offset)` Returns the prime parameter value of the key in plain text.
`org.bouncycastle.crypto.CipherParameters` | `getParameters()` Get `DSAKeyParameters`
`short` | `getQ(byte[] buffer, short offset)` Returns the subprime parameter value of the key in plain text.
`boolean` | `isInitialized()` Reports the initialized state of the key.
`void` | `setG(byte[] buffer, short offset, short length)` Sets the base parameter value of the key.
`void` | `setP(byte[] buffer, short offset, short length)` Sets the prime parameter value of the key.
`void` | `setQ(byte[] buffer, short offset, short length)` Sets the subprime parameter value of the key.

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`

Field Detail

### p

    protected ByteContainer p

### q

    protected ByteContainer q

### g

    protected ByteContainer g

### isPrivate

    protected boolean isPrivate

Constructor Detail

### DSAKeyImpl

    public DSAKeyImpl(byte keyType,
                      short size)

  Construct not-initialized dsa key

  Parameters:
    `keyType` - - key type
    `keySize` - - key size in bits
  See Also:
    `KeyPair`, `KeyBuilder`

### DSAKeyImpl

    public DSAKeyImpl(org.bouncycastle.crypto.params.DSAKeyParameters params)

  Construct and initialize dsa key with DSAKeyParameters. Use in KeyPairImpl

  See Also:
    `KeyPair`, `DSAKeyParameters`

Method Detail

### 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`

### 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`
  Returns:
    `true` if the key has been initialized

### setP

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

  Description copied from interface: `DSAKey`
  Sets the prime parameter value of the 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 prime 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 prime parameter value is decrypted using the `Cipher` object.

  Specified by:
    `setP` in interface `DSAKey`
  Parameters:
    `buffer` - the input buffer
    `offset` - the offset into the input buffer at which the prime parameter value begins
    `length` - the length of the prime parameter value
  Throws:
    `CryptoException` - with the following reason code:
    - `CryptoException.ILLEGAL_VALUE` if the input parameter data length is inconsistent with the implementation or if input data decryption is required and fails.

### setQ

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

  Description copied from interface: `DSAKey`
  Sets the subprime parameter value of the 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 subprime 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 subprime parameter value is decrypted using the `Cipher` object.

  Specified by:
    `setQ` in interface `DSAKey`
  Parameters:
    `buffer` - the input buffer
    `offset` - the offset into the input buffer at which the subprime parameter value begins
    `length` - the length of the subprime parameter value
  Throws:
    `CryptoException` - with the following reason code:
    - `CryptoException.ILLEGAL_VALUE` if the input parameter data length is inconsistent with the implementation or if input data decryption is required and fails.

### setG

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

  Description copied from interface: `DSAKey`
  Sets the base parameter value of the 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 base 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 base parameter value is decrypted using the `Cipher` object.

  Specified by:
    `setG` in interface `DSAKey`
  Parameters:
    `buffer` - the input buffer
    `offset` - the offset into the input buffer at which the base parameter value begins
    `length` - the length of the base parameter value
  Throws:
    `CryptoException` - with the following reason code:
    - `CryptoException.ILLEGAL_VALUE` if the input parameter data length is inconsistent with the implementation or if input data decryption is required and fails.

### getP

    public short getP(byte[] buffer,
                      short offset)

  Description copied from interface: `DSAKey`
  Returns the prime parameter 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).

  Specified by:
    `getP` in interface `DSAKey`
  Parameters:
    `buffer` - the output buffer
    `offset` - the offset into the output buffer at which the prime parameter value starts
  Returns:
    the byte length of the prime parameter value returned
  See Also:
    `Key`

### getQ

    public short getQ(byte[] buffer,
                      short offset)

  Description copied from interface: `DSAKey`
  Returns the subprime parameter 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).

  Specified by:
    `getQ` in interface `DSAKey`
  Parameters:
    `buffer` - the output buffer
    `offset` - the offset into the output buffer at which the subprime parameter value begins
  Returns:
    the byte length of the subprime parameter value returned
  See Also:
    `Key`

### getG

    public short getG(byte[] buffer,
                      short offset)

  Description copied from interface: `DSAKey`
  Returns the base parameter 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).

  Specified by:
    `getG` in interface `DSAKey`
  Parameters:
    `buffer` - the output buffer
    `offset` - the offset into the output buffer at which the base parameter value begins
  Returns:
    the byte length of the base parameter value returned
  See Also:
    `Key`

### getParameters

    public org.bouncycastle.crypto.CipherParameters getParameters()

  Get `DSAKeyParameters`

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

### getKeyGenerationParameters

    public org.bouncycastle.crypto.KeyGenerationParameters getKeyGenerationParameters(SecureRandom rnd)

  Get `DSAKeyGenerationParameters`

  Specified by:
    `getKeyGenerationParameters` in interface `KeyWithParameters`
  Parameters:
    `rnd` - Secure Random Generator
  Returns:
    parameters for use with BouncyCastle API

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