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

org.bouncycastle.crypto.signers

## Class StandardDSAEncoding

- java.lang.Object
- - org.bouncycastle.crypto.signers.StandardDSAEncoding

- All Implemented Interfaces:
    DSAEncoding

      public class StandardDSAEncoding
      extends java.lang.Object
      implements DSAEncoding

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static StandardDSAEncoding` | `INSTANCE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StandardDSAEncoding()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.math.BigInteger` | `checkValue(java.math.BigInteger n, java.math.BigInteger x)`
    `java.math.BigInteger[]` | `decode(java.math.BigInteger n, byte[] encoding)` Decode the (r, s) pair of a DSA signature.
    `protected java.math.BigInteger` | `decodeValue(java.math.BigInteger n, ASN1Sequence s, int pos)`
    `byte[]` | `encode(java.math.BigInteger n, java.math.BigInteger r, java.math.BigInteger s)` Encode the (r, s) pair of a DSA signature.
    `protected ASN1Integer` | `encodeValue(java.math.BigInteger n, java.math.BigInteger x)`

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

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

- - ### Field Detail

    - #### INSTANCE

          public static final StandardDSAEncoding INSTANCE

  - ### Constructor Detail

    - #### StandardDSAEncoding

          public StandardDSAEncoding()

  - ### Method Detail

    - #### decode

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

      Description copied from interface: `DSAEncoding`
      Decode the (r, s) pair of a DSA signature.
      Specified by:
        `decode` in interface `DSAEncoding`
      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

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

      Description copied from interface: `DSAEncoding`
      Encode the (r, s) pair of a DSA signature.
      Specified by:
        `encode` in interface `DSAEncoding`
      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`

    - #### checkValue

          protected java.math.BigInteger checkValue(java.math.BigInteger n,
                                                    java.math.BigInteger x)

    - #### decodeValue

          protected java.math.BigInteger decodeValue(java.math.BigInteger n,
                                                     ASN1Sequence s,
                                                     int pos)

    - #### encodeValue

          protected ASN1Integer encodeValue(java.math.BigInteger n,
                                            java.math.BigInteger x)