Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

rsa.h File Reference

rsa.h File Reference

RSA public-key cryptography standard. More...

Go to the source code of this file.

Data Structures

struct  RsaPublicKey
 RSA public key. More...
struct  RsaPrivateKey
 RSA private key. More...

Functions

void rsaInitPublicKey (RsaPublicKey *key)
 Initialize a RSA public key.
void rsaFreePublicKey (RsaPublicKey *key)
 Release a RSA public key.
void rsaInitPrivateKey (RsaPrivateKey *key)
 Initialize a RSA private key.
void rsaFreePrivateKey (RsaPrivateKey *key)
 Release a RSA private key.
error_t rsaep (const RsaPublicKey *key, const Mpi *m, Mpi *c)
 RSA encryption primitive.
error_t rsadp (const RsaPrivateKey *key, const Mpi *c, Mpi *m)
 RSA decryption primitive.
error_t rsasp1 (const RsaPrivateKey *key, const Mpi *m, Mpi *s)
 RSA signature primitive.
error_t rsavp1 (const RsaPublicKey *key, const Mpi *s, Mpi *m)
 RSA verification primitive.
error_t rsaesPkcs1v15Encrypt (const PrngAlgo *prngAlgo, void *prngContext, const RsaPublicKey *key, const uint8_t *message, size_t messageLength, uint8_t *ciphertext, size_t *ciphertextLength)
 PKCS #1 v1.5 encryption operation.
error_t rsaesPkcs1v15Decrypt (const RsaPrivateKey *key, const uint8_t *ciphertext, size_t ciphertextLength, uint8_t *message, size_t messageSize, size_t *messageLength)
 PKCS #1 v1.5 decryption operation.
error_t rsassaPkcs1v15Sign (const RsaPrivateKey *key, const HashAlgo *hash, const uint8_t *digest, uint8_t *signature, size_t *signatureLength)
 PKCS #1 v1.5 signature generation operation.
error_t rsassaPkcs1v15Verify (const RsaPublicKey *key, const HashAlgo *hash, const uint8_t *digest, const uint8_t *signature, size_t signatureLength)
 PKCS #1 v1.5 signature verification operation.
error_t emsaPkcs1v15Encode (const HashAlgo *hash, const uint8_t *digest, uint8_t *em, size_t emLength)
 PKCS #1 v1.5 encoding method.
error_t emsaPkcs1v15Decode (const uint8_t *em, size_t emLength, const uint8_t **oid, size_t *oidLength, const uint8_t **digest, size_t *digestLength)
 PKCS #1 v1.5 decoding method.

Detailed Description

RSA public-key cryptography standard.

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.

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

Definition in file rsa.h.


Function Documentation

error_t emsaPkcs1v15Decode ( const uint8_t *  em,
size_t  emLength,
const uint8_t **  oid,
size_t *  oidLength,
const uint8_t **  digest,
size_t *  digestLength 
)

PKCS #1 v1.5 decoding method.

Parameters:
[in]emEncoded message
[in]emLengthLength of the encoded message
[out]oidHash algorithm OID
[out]oidLengthLength of the hash algorithm OID
[out]digestDigest value
[out]digestLengthLength of the digest value
Returns:
Error code

Definition at line 841 of file rsa.c.

error_t emsaPkcs1v15Encode ( const HashAlgo hash,
const uint8_t *  digest,
uint8_t *  em,
size_t  emLength 
)

PKCS #1 v1.5 encoding method.

Parameters:
[in]hashHash function used to digest the message
[in]digestDigest of the message to be signed
[out]emEncoded message
[in]emLengthIntended length of the encoded message
Returns:
Error code

Definition at line 777 of file rsa.c.

error_t rsadp ( const RsaPrivateKey key,
const Mpi c,
Mpi m 
)

RSA decryption primitive.

The RSA decryption primitive recovers the message representative from the ciphertext representative under the control of a private key

Parameters:
[in]keyRSA private key
[in]cCiphertext representative
[out]mMessage representative
Returns:
Error code

Definition at line 177 of file rsa.c.

error_t rsaep ( const RsaPublicKey key,
const Mpi m,
Mpi c 
)

RSA encryption primitive.

The RSA encryption primitive produces a ciphertext representative from a message representative under the control of a public key

Parameters:
[in]keyRSA public key
[in]mMessage representative
[out]cCiphertext representative
Returns:
Error code

Definition at line 150 of file rsa.c.

error_t rsaesPkcs1v15Decrypt ( const RsaPrivateKey key,
const uint8_t *  ciphertext,
size_t  ciphertextLength,
uint8_t *  message,
size_t  messageSize,
size_t *  messageLength 
)

PKCS #1 v1.5 decryption operation.

Parameters:
[in]keyRecipient's RSA private key
[in]ciphertextCiphertext to be decrypted
[in]ciphertextLengthLength of the ciphertext to be decrypted
[out]messageOutput buffer where to store the decrypted message
[in]messageSizeSize of the output buffer
[out]messageLengthLength of the decrypted message
Returns:
Error code

Definition at line 421 of file rsa.c.

error_t rsaesPkcs1v15Encrypt ( const PrngAlgo prngAlgo,
void *  prngContext,
const RsaPublicKey key,
const uint8_t *  message,
size_t  messageLength,
uint8_t *  ciphertext,
size_t *  ciphertextLength 
)

PKCS #1 v1.5 encryption operation.

Parameters:
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[in]keyRecipient's RSA public key
[in]messageMessage to be encrypted
[in]messageLengthLength of the message to be encrypted
[out]ciphertextCiphertext resulting from the encryption operation
[out]ciphertextLengthLength of the resulting ciphertext
Returns:
Error code

Definition at line 286 of file rsa.c.

void rsaFreePrivateKey ( RsaPrivateKey key )

Release a RSA private key.

Parameters:
[in]keyPointer to the RSA private key to free

Definition at line 124 of file rsa.c.

void rsaFreePublicKey ( RsaPublicKey key )

Release a RSA public key.

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

Definition at line 92 of file rsa.c.

void rsaInitPrivateKey ( RsaPrivateKey key )

Initialize a RSA private key.

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

Definition at line 105 of file rsa.c.

void rsaInitPublicKey ( RsaPublicKey key )

Initialize a RSA public key.

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

Definition at line 79 of file rsa.c.

error_t rsasp1 ( const RsaPrivateKey key,
const Mpi m,
Mpi s 
)

RSA signature primitive.

The RSA signature primitive produces a signature representative from a message representative under the control of a private key

Parameters:
[in]keyRSA private key
[in]mMessage representative
[out]sSignature representative
Returns:
Error code

Definition at line 244 of file rsa.c.

error_t rsassaPkcs1v15Sign ( const RsaPrivateKey key,
const HashAlgo hash,
const uint8_t *  digest,
uint8_t *  signature,
size_t *  signatureLength 
)

PKCS #1 v1.5 signature generation operation.

Parameters:
[in]keySigner's RSA private key
[in]hashHash function used to digest the message
[in]digestDigest of the message to be signed
[out]signatureResulting signature
[out]signatureLengthLength of the resulting signature
Returns:
Error code

Definition at line 561 of file rsa.c.

error_t rsassaPkcs1v15Verify ( const RsaPublicKey key,
const HashAlgo hash,
const uint8_t *  digest,
const uint8_t *  signature,
size_t  signatureLength 
)

PKCS #1 v1.5 signature verification operation.

Parameters:
[in]keySigner's RSA public key
[in]hashHash function used to digest the message
[in]digestDigest of the message whose signature is to be verified
[in]signatureSignature to be verified
[in]signatureLengthLength of the signature to be verified
Returns:
Error code

Definition at line 666 of file rsa.c.

error_t rsavp1 ( const RsaPublicKey key,
const Mpi s,
Mpi m 
)

RSA verification primitive.

The RSA verification primitive recovers the message representative from the signature representative under the control of a public key

Parameters:
[in]keyRSA public key
[in]sSignature representative
[out]mMessage representative
Returns:
Error code

Definition at line 265 of file rsa.c.