org.bouncycastle.pqc.crypto.mayo

## Class MayoSigner

- java.lang.Object
- - org.bouncycastle.pqc.crypto.mayo.MayoSigner

- All Implemented Interfaces:
    MessageSigner

      public class MayoSigner
      extends java.lang.Object
      implements MessageSigner

  Implementation of the MAYO digital signature scheme as specified in the MAYO documentation. This class provides functionality for both signature generation and verification.

  MAYO is a candidate in the NIST Post-Quantum Cryptography: Additional Digital Signature Schemes project, currently in Round 2 of evaluations. For more details about the NIST standardization process, see: NIST PQC Additional Digital Signatures.

  References:

  - MAYO Official Website
  - MAYO Specification Document
  - MAYO Reference Implementation (C)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MayoSigner()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `generateSignature(byte[] message)` Generates a MAYO signature for the given message using the initialized private key.
    `void` | `init(boolean forSigning, CipherParameters param)` Initializes the signer for either signature generation or verification.
    `boolean` | `verifySignature(byte[] message, byte[] signature)` Verifies a MAYO signature against the initialized public key and message.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MayoSigner

          public MayoSigner()

  - ### Method Detail

    - #### init

          public void init(boolean forSigning,
                           CipherParameters param)

      Initializes the signer for either signature generation or verification.
      Specified by:
        `init` in interface `MessageSigner`
      Parameters:
        `forSigning` - `true` for signing mode, `false` for verification
        `param` - CipherParameters containing:
        - `ParametersWithRandom` with `MayoPrivateKeyParameters` (for signing)
        - `MayoPublicKeyParameters` (for verification)
      Throws:
        `java.lang.IllegalArgumentException` - if invalid parameters are provided

    - #### generateSignature

          public byte[] generateSignature(byte[] message)

      Generates a MAYO signature for the given message using the initialized private key. Follows the signature generation process outlined in the MAYO specification document.
      Specified by:
        `generateSignature` in interface `MessageSigner`
      Parameters:
        `message` - The message to be signed
      Returns:
        The signature bytes concatenated with the original message
      See Also:
        MAYO Spec Algorithm 8 and 10

    - #### verifySignature

          public boolean verifySignature(byte[] message,
                                         byte[] signature)

      Verifies a MAYO signature against the initialized public key and message. Implements the verification process specified in the MAYO documentation.
      Specified by:
        `verifySignature` in interface `MessageSigner`
      Parameters:
        `message` - The original message
        `signature` - The signature to verify
      Returns:
        `true` if the signature is valid, `false` otherwise
      See Also:
        MAYO Spec Algorithm 9 and 11