Interface AsymmetricJWK<A extends PublicKey,B extends PrivateKey>

Type Parameters:
A - the public key type
B - the private key type
All Superinterfaces:
JWK
All Known Subinterfaces:
ECJWK, EdECJWK, OKPJWK<A,B>, RSAJWK, X509JWK<A,B>, XECJWK

public interface AsymmetricJWK<A extends PublicKey,B extends PrivateKey> extends JWK

An asymmetric JSON Web Key based on asymmetric public and private keys.

Since:
1.5
Author:
Jeremy Kuhn
  • Method Details

    • toPublicKey

      A toPublicKey() throws JWKProcessingException

      Converts the JWK to its corresponding public key.

      Returns:
      a public key
      Throws:
      JWKProcessingException - if there was an error converting the JWK to a public key
    • toPrivateKey

      Optional<B> toPrivateKey() throws JWKProcessingException

      Converts the JWK to its corresponding private key.

      Returns:
      an optional containing the private key or an empty optional if the key does not contain private information
      Throws:
      JWKProcessingException - if there was an error converting the JWK to a private key
    • toPublicJWK

      AsymmetricJWK<A,B> toPublicJWK()
      Description copied from interface: JWK

      Returns a public and safe to share representation of the key.

      Specified by:
      toPublicJWK in interface JWK
      Returns:
      a public representation of this JWK
    • trust

      AsymmetricJWK<A,B> trust()
      Description copied from interface: JWK

      Trusts the key explicitly.

      This should be used with care when the authenticity of an untrusted key has been established through external means.

      Specified by:
      trust in interface JWK
      Returns:
      this JWK