McElieceCCA2KeyFactorySpi (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.pqc.jcajce.provider.mceliece

## Class McElieceCCA2KeyFactorySpi

- java.lang.Object
- - java.security.KeyFactorySpi
  - - org.bouncycastle.pqc.jcajce.provider.mceliece.McElieceCCA2KeyFactorySpi

-     public class McElieceCCA2KeyFactorySpi
      extends java.security.KeyFactorySpi

  This class is used to translate between McEliece CCA2 keys and key specifications.
  See Also:
    `BCMcElieceCCA2PrivateKey`, `McElieceCCA2PrivateKeySpec`, `BCMcElieceCCA2PublicKey`, `McElieceCCA2PublicKeySpec`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `OID` The OID of the algorithm.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `McElieceCCA2KeyFactorySpi()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.security.PrivateKey` | `engineGeneratePrivate(java.security.spec.KeySpec keySpec)`
    `protected java.security.PublicKey` | `engineGeneratePublic(java.security.spec.KeySpec keySpec)`
    `protected java.security.spec.KeySpec` | `engineGetKeySpec(java.security.Key key, java.lang.Class tClass)`
    `protected java.security.Key` | `engineTranslateKey(java.security.Key key)`
    `java.security.PrivateKey` | `generatePrivate(java.security.spec.KeySpec keySpec)` Converts, if possible, a key specification into a `BCMcElieceCCA2PrivateKey`.
    `java.security.PrivateKey` | `generatePrivate(PrivateKeyInfo pki)`
    `java.security.PublicKey` | `generatePublic(java.security.spec.KeySpec keySpec)` Converts, if possible, a key specification into a `BCMcElieceCCA2PublicKey`.
    `java.security.PublicKey` | `generatePublic(SubjectPublicKeyInfo pki)`
    `java.security.spec.KeySpec` | `getKeySpec(java.security.Key key, java.lang.Class keySpec)` Converts, if possible, a given key into a key specification.
    `java.security.Key` | `translateKey(java.security.Key key)` Translates a key into a form known by the FlexiProvider.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### OID

          public static final java.lang.String OID

      The OID of the algorithm.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### McElieceCCA2KeyFactorySpi

          public McElieceCCA2KeyFactorySpi()

  - ### Method Detail

    - #### generatePublic

          public java.security.PublicKey generatePublic(java.security.spec.KeySpec keySpec)
                                                 throws java.security.spec.InvalidKeySpecException

      Converts, if possible, a key specification into a `BCMcElieceCCA2PublicKey`. Currently, the following key specifications are supported: `McElieceCCA2PublicKeySpec`, `X509EncodedKeySpec`.
      Parameters:
        `keySpec` - the key specification
      Returns:
        the McEliece CCA2 public key
      Throws:
        `java.security.spec.InvalidKeySpecException` - if the key specification is not supported.

    - #### generatePrivate

          public java.security.PrivateKey generatePrivate(java.security.spec.KeySpec keySpec)
                                                   throws java.security.spec.InvalidKeySpecException

      Converts, if possible, a key specification into a `BCMcElieceCCA2PrivateKey`. Currently, the following key specifications are supported: `McElieceCCA2PrivateKeySpec`, `PKCS8EncodedKeySpec`.
      Parameters:
        `keySpec` - the key specification
      Returns:
        the McEliece CCA2 private key
      Throws:
        `java.security.spec.InvalidKeySpecException` - if the KeySpec is not supported.

    - #### getKeySpec

          public java.security.spec.KeySpec getKeySpec(java.security.Key key,
                                              java.lang.Class keySpec)
                                                throws java.security.spec.InvalidKeySpecException

      Converts, if possible, a given key into a key specification. Currently, the following key specifications are supported:
      - for McElieceCCA2PublicKey: `X509EncodedKeySpec`, `McElieceCCA2PublicKeySpec`
      - for McElieceCCA2PrivateKey: `PKCS8EncodedKeySpec`, `McElieceCCA2PrivateKeySpec`
      .
      Parameters:
        `key` - the key
        `keySpec` - the key specification
      Returns:
        the specification of the McEliece CCA2 key
      Throws:
        `java.security.spec.InvalidKeySpecException` - if the key type or the key specification is not supported.
      See Also:
        `BCMcElieceCCA2PrivateKey`, `McElieceCCA2PrivateKeySpec`, `BCMcElieceCCA2PublicKey`, `McElieceCCA2PublicKeySpec`

    - #### translateKey

          public java.security.Key translateKey(java.security.Key key)
                                         throws java.security.InvalidKeyException

      Translates a key into a form known by the FlexiProvider. Currently, only the following "source" keys are supported: `BCMcElieceCCA2PrivateKey`, `BCMcElieceCCA2PublicKey`.
      Parameters:
        `key` - the key
      Returns:
        a key of a known key type
      Throws:
        `java.security.InvalidKeyException` - if the key type is not supported.

    - #### generatePublic

          public java.security.PublicKey generatePublic(SubjectPublicKeyInfo pki)
                                                 throws java.security.spec.InvalidKeySpecException

      Throws:
        `java.security.spec.InvalidKeySpecException`

    - #### generatePrivate

          public java.security.PrivateKey generatePrivate(PrivateKeyInfo pki)
                                                   throws java.security.spec.InvalidKeySpecException

      Throws:
        `java.security.spec.InvalidKeySpecException`

    - #### engineGeneratePublic

          protected java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
                                                          throws java.security.spec.InvalidKeySpecException

      Specified by:
        `engineGeneratePublic` in class `java.security.KeyFactorySpi`
      Throws:
        `java.security.spec.InvalidKeySpecException`

    - #### engineGeneratePrivate

          protected java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec)
                                                            throws java.security.spec.InvalidKeySpecException

      Specified by:
        `engineGeneratePrivate` in class `java.security.KeyFactorySpi`
      Throws:
        `java.security.spec.InvalidKeySpecException`

    - #### engineGetKeySpec

          protected java.security.spec.KeySpec engineGetKeySpec(java.security.Key key,
                                                    java.lang.Class tClass)
                                                         throws java.security.spec.InvalidKeySpecException

      Specified by:
        `engineGetKeySpec` in class `java.security.KeyFactorySpi`
      Throws:
        `java.security.spec.InvalidKeySpecException`

    - #### engineTranslateKey

          protected java.security.Key engineTranslateKey(java.security.Key key)
                                                  throws java.security.InvalidKeyException

      Specified by:
        `engineTranslateKey` in class `java.security.KeyFactorySpi`
      Throws:
        `java.security.InvalidKeyException`