Class PublicKeyValues

java.lang.Object
com.yubico.yubikit.core.keys.PublicKeyValues
Direct Known Subclasses:
PublicKeyValues.Cv25519, PublicKeyValues.Ec, PublicKeyValues.Rsa

public abstract class PublicKeyValues extends Object
Values defining a public key, such as an RSA or EC key.
  • Field Details

    • bitLength

      protected final int bitLength
  • Constructor Details

    • PublicKeyValues

      protected PublicKeyValues(int bitLength)
  • Method Details

    • getBitLength

      public final int getBitLength()
    • getEncoded

      public abstract byte[] getEncoded()
    • toPublicKey

      public abstract PublicKey toPublicKey() throws NoSuchAlgorithmException, InvalidKeySpecException
      Instantiates a JCA PublicKey using the contained parameters.

      This requires a SecurityProvider capable of handling the key type.

      Returns:
      a public key, usable for cryptographic operations
      Throws:
      NoSuchAlgorithmException - if no Provider supports an implementation for the specified algorithm.
      InvalidKeySpecException - if the given key specification is inappropriate for this key factory to produce a public key.
    • fromPublicKey

      public static PublicKeyValues fromPublicKey(PublicKey publicKey)