Class OkpJWK.Builder

java.lang.Object
org.forgerock.json.jose.jwk.JWK.Builder<OkpJWK.Builder>
org.forgerock.json.jose.jwk.OkpJWK.Builder
Enclosing class:
OkpJWK

public static class OkpJWK.Builder extends JWK.Builder<OkpJWK.Builder>
Builder object for Octet Key-Pair (OKP) JWKs.
  • Method Details

    • curve

      public OkpJWK.Builder curve(SupportedEllipticCurve curve)
      Sets the elliptic curve that this key uses. Must be one of the supported EdDSA or X25519/X448 curves defined in RFC 8037.
      Parameters:
      curve - the supported elliptic curve.
      Returns:
      this builder object.
    • x

      public OkpJWK.Builder x(String x)
      Sets the public key x-coordinate of the key.
      Parameters:
      x - the x-coordinate of the key.
      Returns:
      this builder object.
    • d

      public OkpJWK.Builder d(String d)
      Sets the private key d-value of the key.
      Parameters:
      d - the private key value.
      Returns:
      this builder object.
    • privateKey

      public OkpJWK.Builder privateKey(PrivateKey privateKey)
      Sets the private key d-value from the given private key.
      Parameters:
      privateKey - the private key.
      Returns:
      this builder object.
    • publicKey

      public OkpJWK.Builder publicKey(PublicKey publicKey)
      Sets the public x-coordinate from the given public key.
      Parameters:
      publicKey - the public key. Must either be a XECPublicKey or OctetECPublicKey
      Returns:
      this builder object.
    • xecPublicKey

      public OkpJWK.Builder xecPublicKey(PublicKey xecPublicKey)
      Sets the public x-coordinate from the given XECPublicKey (Java 11+).
      Parameters:
      xecPublicKey - the XECPublicKey.
      Returns:
      this builder object.
    • xecPrivateKey

      public OkpJWK.Builder xecPrivateKey(PrivateKey xecPrivateKey)
      Sets the private scalar value from the given XECPrivateKey (Java 11+).
      Parameters:
      xecPrivateKey - the XECPrivateKey.
      Returns:
      this builder object.
    • keyPair

      public OkpJWK.Builder keyPair(KeyPair keyPair)
      Sets the public and private values from the given key pair.
      Parameters:
      keyPair - the key pair
      Returns:
      this builder object.
    • build

      public OkpJWK build()
      Description copied from class: JWK.Builder
      Builds the JWK.
      Specified by:
      build in class JWK.Builder<OkpJWK.Builder>
      Returns:
      the JWK.