Class PubSecKeyOptions

java.lang.Object
io.vertx.ext.auth.PubSecKeyOptions

public class PubSecKeyOptions extends Object
Options describing Key stored in PEM format.

When these options are created from JSON (for example when loading the configuration from a file), the buffer field is a Buffer, which in JSON is represented as the base64 encoding of the key bytes, not the PEM text itself. Given the PEM (or secret) as a String, the JSON form can be obtained with new PubSecKeyOptions().setBuffer(pem).toJson(), e.g.:

{
  "algorithm": "ES256",
  "buffer": "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0K..."
}
Author:
Paulo Lopes
  • Constructor Details

    • PubSecKeyOptions

      public PubSecKeyOptions()
      Default constructor
    • PubSecKeyOptions

      public PubSecKeyOptions(PubSecKeyOptions other)
      Copy constructor
      Parameters:
      other - the options to copy
    • PubSecKeyOptions

      public PubSecKeyOptions(JsonObject json)
      Constructor to create an options from JSON
      Parameters:
      json - the JSON
  • Method Details

    • toJson

      public JsonObject toJson()
    • getAlgorithm

      public String getAlgorithm()
    • setAlgorithm

      public PubSecKeyOptions setAlgorithm(String algorithm)
    • getBuffer

      public Buffer getBuffer()
      The PEM or Secret key buffer. When working with secret materials, the material is expected to be encoded in UTF-8. PEM files are expected to be US_ASCII as the format uses a base64 encoding for the payload.
      Returns:
      the buffer.
    • setBuffer

      public PubSecKeyOptions setBuffer(String buffer)
      The PEM or Secret key buffer. When working with secret materials, the material is expected to be encoded in UTF-8. PEM files are expected to be US_ASCII as the format uses a base64 encoding for the payload.

      This setter is a convenience for Java code and takes the PEM/secret text as is. In JSON the buffer field must be the base64 encoding of these bytes, see setBuffer(Buffer).

      Returns:
      self.
    • setBuffer

      public PubSecKeyOptions setBuffer(Buffer buffer)
      The PEM or Secret key buffer. When working with secret materials, the material is expected to be encoded in UTF-8. PEM files are expected to be US_ASCII as the format uses a base64 encoding for the payload.

      This is the setter used when the options are created from JSON: the JSON value of buffer is the base64 encoding of the key bytes (the standard JSON representation of a Buffer).

      Returns:
      self.
    • getId

      public String getId()
    • setId

      public PubSecKeyOptions setId(String id)