DSAEncoding (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.crypto.signers

## Interface DSAEncoding

- All Known Implementing Classes:
    PlainDSAEncoding, StandardDSAEncoding

      public interface DSAEncoding

  An interface for different encoding formats for DSA signatures.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.math.BigInteger[]` | `decode(java.math.BigInteger n, byte[] encoding)` Decode the (r, s) pair of a DSA signature.
    `byte[]` | `encode(java.math.BigInteger n, java.math.BigInteger r, java.math.BigInteger s)` Encode the (r, s) pair of a DSA signature.

- - ### Method Detail

    - #### decode

          java.math.BigInteger[] decode(java.math.BigInteger n,
                                        byte[] encoding)
                                 throws java.io.IOException

      Decode the (r, s) pair of a DSA signature.
      Parameters:
        `n` - the order of the group that r, s belong to.
        `encoding` - an encoding of the (r, s) pair of a DSA signature.
      Returns:
        the (r, s) of a DSA signature, stored in an array of exactly two elements, r followed by s.
      Throws:
        `java.io.IOException`

    - #### encode

          byte[] encode(java.math.BigInteger n,
                        java.math.BigInteger r,
                        java.math.BigInteger s)
                 throws java.io.IOException

      Encode the (r, s) pair of a DSA signature.
      Parameters:
        `n` - the order of the group that r, s belong to.
        `r` - the r value of a DSA signature.
        `s` - the s value of a DSA signature.
      Returns:
        an encoding of the DSA signature given by the provided (r, s) pair.
      Throws:
        `java.io.IOException`