Crypto++ 8.6 Free C++ class library of cryptographic schemes

Enumerations | Functions
dsa.h File Reference

Classes for the DSA signature algorithm. More...

Go to the source code of this file.

## Enumerations
enum | DSASignatureFormat { DSA_P1363, DSA_DER, DSA_OPENPGP }
| DSA Signature Format. More...

## Functions
size_t | DSAConvertSignatureFormat (byte *buffer, size_t bufferSize, DSASignatureFormat toFormat, const byte *signature, size_t signatureLen, DSASignatureFormat fromFormat)
| Converts between signature encoding formats. More...

## Detailed Description

Classes for the DSA signature algorithm.

Definition in file dsa.h.

## Enumeration Type Documentation

## ◆ DSASignatureFormat

enum DSASignatureFormat

DSA Signature Format.

The DSA signature format used by Crypto++ is as defined by IEEE P1363. OpenSSL, Java and .Net use the DER format, and OpenPGP uses the OpenPGP format.

See also
  DSAConvertSignatureFormat on the Crypto++ wiki.

Since
  Crypto++ 1.0

Enumerator
DSA_P1363 | Crypto++ native signature encoding format.
DSA_DER | signature encoding format used by OpenSSL, Java and .Net
DSA_OPENPGP | OpenPGP signature encoding format.

Definition at line 20 of file dsa.h.

## Function Documentation

## ◆ DSAConvertSignatureFormat()

size_t DSAConvertSignatureFormat | ( | byte * | buffer,
|  | size_t | bufferSize,
|  | DSASignatureFormat | toFormat,
|  | const byte * | signature,
|  | size_t | signatureLen,
|  | DSASignatureFormat | fromFormat
| ) |  |

Converts between signature encoding formats.

Parameters

  buffer | byte buffer for the converted signature encoding
  bufferSize | the length of the converted signature encoding buffer
  toFormat | the source signature format
  signature | byte buffer for the existing signature encoding
  signatureLen | the length of the existing signature encoding buffer
  fromFormat | the source signature format

Returns
  the number of bytes written during encoding

This function converts between these formats, and returns length of signature in the target format. If `toFormat == DSA_P1363`, then `bufferSize` must equal `publicKey.SignatureLength()` or `verifier.SignatureLength()`.

If the destination buffer is too small then the output of the encoded `r` and `s` will be truncated. Be sure to provide an adequately sized buffer and check the return value for the number of bytes written.

See also
  DSAConvertSignatureFormat on the Crypto++ wiki.

Since
  Crypto++ 1.0