org.bouncycastle.crypto.signers.DSAEncoding Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-jdk15to18 Show documentation
Show all versions of bcprov-jdk15to18 Show documentation
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 to JDK 1.8.
package org.bouncycastle.crypto.signers;
import java.io.IOException;
import java.math.BigInteger;
/**
* An interface for different encoding formats for DSA signatures.
*/
public interface DSAEncoding
{
/**
* Decode the (r, s) pair of a DSA signature.
*
* @param n the order of the group that r, s belong to.
* @param encoding an encoding of the (r, s) pair of a DSA signature.
* @return the (r, s) of a DSA signature, stored in an array of exactly two elements, r followed by s.
* @throws IOException
*/
BigInteger[] decode(BigInteger n, byte[] encoding) throws IOException;
/**
* Encode the (r, s) pair of a DSA signature.
*
* @param n the order of the group that r, s belong to.
* @param r the r value of a DSA signature.
* @param s the s value of a DSA signature.
* @return an encoding of the DSA signature given by the provided (r, s) pair.
* @throws IOException
*/
byte[] encode(BigInteger n, BigInteger r, BigInteger s) throws IOException;
}