Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

dsa.c File Reference

dsa.c File Reference

DSA (Digital Signature Algorithm) More...

Go to the source code of this file.

Functions

void dsaInitPublicKey (DsaPublicKey *key)
 Initialize a DSA public key.
void dsaFreePublicKey (DsaPublicKey *key)
 Release a DSA public key.
void dsaInitPrivateKey (DsaPrivateKey *key)
 Initialize a DSA private key.
void dsaFreePrivateKey (DsaPrivateKey *key)
 Release a DSA private key.
void dsaInitSignature (DsaSignature *signature)
 Initialize a DSA signature.
void dsaFreeSignature (DsaSignature *signature)
 Release a DSA signature.
error_t dsaWriteSignature (const DsaSignature *signature, uint8_t *data, size_t *length)
 Encode DSA signature using ASN.1.
error_t dsaReadSignature (const uint8_t *data, size_t length, DsaSignature *signature)
 Read an ASN.1 encoded DSA signature.
error_t dsaGenerateSignature (const PrngAlgo *prngAlgo, void *prngContext, const DsaPrivateKey *key, const uint8_t *digest, size_t digestLength, DsaSignature *signature)
 DSA signature generation.
error_t dsaVerifySignature (const DsaPublicKey *key, const uint8_t *digest, size_t digestLength, const DsaSignature *signature)
 DSA signature verification.

Detailed Description

DSA (Digital Signature Algorithm)

License

Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCrypto Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Description

The Digital Signature Algorithm (DSA) is a an algorithm developed by the NSA to generate a digital signature for the authentication of electronic documents. Refer to FIPS 186-3 for more details

Author:
Oryx Embedded SARL (www.oryx-embedded.com)
Version:
1.7.6

Definition in file dsa.c.


Function Documentation

void dsaFreePrivateKey ( DsaPrivateKey key )

Release a DSA private key.

Parameters:
[in]keyPointer to the DSA public key to free

Definition at line 121 of file dsa.c.

void dsaFreePublicKey ( DsaPublicKey key )

Release a DSA public key.

Parameters:
[in]keyPointer to the DSA public key to free

Definition at line 91 of file dsa.c.

void dsaFreeSignature ( DsaSignature signature )

Release a DSA signature.

Parameters:
[in]signaturePointer to the DSA signature to free

Definition at line 149 of file dsa.c.

error_t dsaGenerateSignature ( const PrngAlgo prngAlgo,
void *  prngContext,
const DsaPrivateKey key,
const uint8_t *  digest,
size_t  digestLength,
DsaSignature signature 
)

DSA signature generation.

Parameters:
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]keySigner's DSA private key
[in]digestDigest of the message to be signed
[in]digestLengthLength in octets of the digest
[out]signature(R, S) integer pair
Returns:
Error code

Definition at line 427 of file dsa.c.

void dsaInitPrivateKey ( DsaPrivateKey key )

Initialize a DSA private key.

Parameters:
[in]keyPointer to the DSA private key to initialize

Definition at line 106 of file dsa.c.

void dsaInitPublicKey ( DsaPublicKey key )

Initialize a DSA public key.

Parameters:
[in]keyPointer to the DSA public key to initialize

Definition at line 76 of file dsa.c.

void dsaInitSignature ( DsaSignature signature )

Initialize a DSA signature.

Parameters:
[in]signaturePointer to the DSA signature to initialize

Definition at line 136 of file dsa.c.

error_t dsaReadSignature ( const uint8_t *  data,
size_t  length,
DsaSignature signature 
)

Read an ASN.1 encoded DSA signature.

Parameters:
[in]dataPointer to the ASN.1 structure to decode
[in]lengthLength of the ASN.1 structure
[out]signature(R, S) integer pair
Returns:
Error code

Definition at line 321 of file dsa.c.

error_t dsaVerifySignature ( const DsaPublicKey key,
const uint8_t *  digest,
size_t  digestLength,
const DsaSignature signature 
)

DSA signature verification.

Parameters:
[in]keySigner's DSA public key
[in]digestDigest of the message whose signature is to be verified
[in]digestLengthLength in octets of the digest
[in]signature(R, S) integer pair
Returns:
Error code

Definition at line 533 of file dsa.c.

error_t dsaWriteSignature ( const DsaSignature signature,
uint8_t *  data,
size_t *  length 
)

Encode DSA signature using ASN.1.

Parameters:
[in]signature(R, S) integer pair
[out]dataPointer to the buffer where to store the resulting ASN.1 structure
[out]lengthLength of the ASN.1 structure
Returns:
Error code

Definition at line 165 of file dsa.c.