Enum Class SignatureAlgorithm

java.lang.Object
java.lang.Enum<SignatureAlgorithm>
me.lucko.luckperms.common.webeditor.socket.SignatureAlgorithm
All Implemented Interfaces:
Serializable, Comparable<SignatureAlgorithm>, Constable

public enum SignatureAlgorithm extends Enum<SignatureAlgorithm>
The signature algorithm invalid input: '&' public/private key crypto logic used by the web editor socket connection.
  • Enum Constant Details

  • Field Details

  • Method Details

    • values

      public static SignatureAlgorithm[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SignatureAlgorithm valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • protocolVersion

      public int protocolVersion()
      Gets the corresponding protocol version
      Returns:
      the protocol version
    • parsePublicKey

      public PublicKey parsePublicKey(String base64String) throws IllegalArgumentException
      Parse a public key from the given string.
      Parameters:
      base64String - a base64 string encoding the public key
      Returns:
      the parsed public key
      Throws:
      IllegalArgumentException - if the input was invalid
    • generateKeyPair

      public abstract KeyPair generateKeyPair()
      Generate a public/private key pair.
      Returns:
      the generated key pair
    • sign

      public String sign(PrivateKey privateKey, String msg)
      Signs msg using the given PrivateKey.
      Parameters:
      privateKey - the private key to sign with
      msg - the message
      Returns:
      a base64 string containing the signature
    • verify

      public boolean verify(PublicKey publicKey, String msg, String signatureBase64)
      Verify that the given base64 encoded signature matches the given message and PublicKey.
      Parameters:
      publicKey - the public key that the message was supposedly signed with
      msg - the message
      signatureBase64 - the provided signature
      Returns:
      true if the signature is ok