Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
rsa.c File Reference
RSA public-key cryptography standard. More...
Go to the source code of this file.
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.
Description
RSA is an algorithm for public-key cryptography which is suitable for signing as well as encryption. Refer to PKCS #1 (RSA Cryptography Standard)
- Version:
- 1.7.6
Definition in file rsa.c.
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] em Encoded message [in] emLength Length of the encoded message [out] oid Hash algorithm OID [out] oidLength Length of the hash algorithm OID [out] digest Digest value [out] digestLength Length of the digest value
- Returns:
- Error code
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] key RSA private key [in] c Ciphertext representative [out] m Message representative
- Returns:
- Error code
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] key RSA public key [in] m Message representative [out] c Ciphertext representative
- Returns:
- Error code
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] key Recipient's RSA private key [in] ciphertext Ciphertext to be decrypted [in] ciphertextLength Length of the ciphertext to be decrypted [out] message Output buffer where to store the decrypted message [in] messageSize Size of the output buffer [out] messageLength Length of the decrypted message
- Returns:
- Error code
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] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context [in] key Recipient's RSA public key [in] message Message to be encrypted [in] messageLength Length of the message to be encrypted [out] ciphertext Ciphertext resulting from the encryption operation [out] ciphertextLength Length of the resulting ciphertext
- Returns:
- Error code
void rsaFreePrivateKey | ( | RsaPrivateKey * | key ) |
void rsaFreePublicKey | ( | RsaPublicKey * | key ) |
void rsaInitPrivateKey | ( | RsaPrivateKey * | key ) |
void rsaInitPublicKey | ( | RsaPublicKey * | key ) |
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] key RSA private key [in] m Message representative [out] s Signature representative
- Returns:
- Error code
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] key Signer's RSA private key [in] hash Hash function used to digest the message [in] digest Digest of the message to be signed [out] signature Resulting signature [out] signatureLength Length of the resulting signature
- Returns:
- Error code
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] key Signer's RSA public key [in] hash Hash function used to digest the message [in] digest Digest of the message whose signature is to be verified [in] signature Signature to be verified [in] signatureLength Length of the signature to be verified
- Returns:
- Error code
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] key RSA public key [in] s Signature representative [out] m Message representative
- Returns:
- Error code
Generated on Tue Jul 12 2022 17:10:22 by
