Data Structures | |
struct | C4eRsaKeyPrv |
RSA private key. More... | |
Modules | |
RSA Temp. Space Qualifiers | |
Temp. space qualifiers for RSA based cryptography. | |
Defines | |
#define | C4E_RSA_TMP_NUM(tmpid, keylen) |
Calculate the number of temp. space elements of type C4eAlgo32Digit for RSA algorithms. | |
#define | C4E_RSA_PKCS1V1_EBOH |
Minimum encoding overhead in a PKCS #1 v1.5 respective PEM (RFC 1423) encryption block, in bytes. | |
#define | C4E_RSA_OAEP_EMOH(hlen) |
Minimum encryption overhead in a PKCS #1 v2.1 EME-OAEP encoded message, in bytes. | |
#define | C4E_RSA_PSS_EMLEN(hlen, slen) |
Length of a PKCS #1 v2.1 EMSA-PSS (signature) encoded message, in bytes. | |
Functions | |
C4eSysStatus | c4e_rsa_encrypt_pkcs1v1 (C4eDlcDomain *C4E_RESTRICT dom, C4E_CONST C4eElement *C4E_RESTRICT e, C4E_CONST C4eArchUint8 *C4E_RESTRICT plain, C4eArchSize len, C4eAlgo32Digit tmp[C4E_RESTRICT], C4eArchUint8 *C4E_RESTRICT cipher) |
RSA encryption of a plaintext octet string into a ciphertext octet string, compatible with PKCS #1 v1.5 (block type 2) and Privacy Enhancement for Internet Electronic Mail (PEM). | |
C4eSysStatus | c4e_rsa_decrypt_pkcs1v1 (C4E_CONST C4eDlcDomain *C4E_RESTRICT dom, C4eRsaKeyPrv *key, C4E_CONST C4eArchUint8 *C4E_RESTRICT cipher, C4eAlgo32Digit tmp[C4E_RESTRICT], C4eArchUint8 *C4E_RESTRICT plain, C4eArchSize *C4E_RESTRICT plen) |
RSA decryption of a ciphertext octet string into a plain- text octet string, compatible with PKCS #1 v1.5 (block type 2) and Privacy Enhancement for Internet Electronic Mail (PEM). | |
C4eSysStatus | c4e_rsa_sign_pkcs1v1 (C4E_CONST C4eDlcDomain *C4E_RESTRICT dom, C4eRsaKeyPrv *key, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT digest, C4eAlgo32Digit tmp[C4E_RESTRICT], C4eArchUint8 *C4E_RESTRICT signature) |
RSA signature of a digest, compatible with PKCS #1 v1.5 (block type 1). | |
C4eSysStatus | c4e_rsa_verify_pkcs1v1 (C4eDlcDomain *C4E_RESTRICT dom, C4E_CONST C4eElement *C4E_RESTRICT e, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT digest, C4eAlgo32Digit tmp[C4E_RESTRICT], C4eArchUint8 *C4E_RESTRICT signature, C4eArchSize len) |
PKCS #1 v1.5 (block type 1) RSA signature verification. | |
C4eSysStatus | c4e_rsa_encrypt_pkcs1v2 (C4eDlcDomain *C4E_RESTRICT dom, C4E_CONST C4eElement *C4E_RESTRICT e, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT plain, C4eArchSize len, C4eAlgo32Digit tmp[C4E_RESTRICT], C4eArchUint8 *C4E_RESTRICT cipher) |
RSA encryption of a plaintext octet string into a ciphertext octet string, compatible with PKCS #1 v2.1 (RSAES-OAEP), IEEE Std 1363 (IFES/EME1) and ISO 18033-2 (RSAES/REM1). | |
C4eSysStatus | c4e_rsa_decrypt_pkcs1v2 (C4E_CONST C4eDlcDomain *C4E_RESTRICT dom, C4eRsaKeyPrv *key, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT cipher, C4eAlgo32Digit tmp[C4E_RESTRICT], C4eArchUint8 *C4E_RESTRICT plain, C4eArchSize *C4E_RESTRICT plen) |
RSA decryption of a ciphertext octet string into a plain- text octet string, compatible with PKCS #1 v2.1 (RSAES- OAEP), IEEE Std 1363 (IFES/EME1) and ISO 18033-2 (RSAES/REM1). | |
C4eSysStatus | c4e_rsa_sign_pkcs1v2 (C4E_CONST C4eDlcDomain *C4E_RESTRICT dom, C4eRsaKeyPrv *key, C4eArchSize slen, C4eHashId hid, C4E_CONST C4eArchUint8 *C4E_RESTRICT digest, C4eAlgo32Digit tmp[C4E_RESTRICT], C4eArchUint8 *C4E_RESTRICT signature) |
RSA signature of a digest, compatible with PKCS #1 v2.1 signature scheme RSASSA-PSS. | |
C4eSysStatus | c4e_rsa_verify_pkcs1v2 (C4eDlcDomain *C4E_RESTRICT dom, C4E_CONST C4eElement *C4E_RESTRICT e, C4eHashId hid, C4eArchUint8 *C4E_RESTRICT digest, C4eArchUint8 *C4E_RESTRICT signature, C4eArchSize len, C4eAlgo32Digit tmp[C4E_RESTRICT]) |
PKCS #1 v2.1 RSA signature verification, according to scheme RSASSA-PSS. | |
C4eSysStatus | c4e_rsa_keychk_prv (C4E_CONST C4eDlcDomain *C4E_RESTRICT dom, C4E_CONST C4eRsaKeyPrv *C4E_RESTRICT key, C4eAlgo32Digit tmp[C4E_RESTRICT]) |
Private RSA key validity test. | |
C4eSysStatus | c4e_rsa_keychk_pub (C4E_CONST C4eDlcDomain *C4E_RESTRICT dom, C4E_CONST C4eElement *C4E_RESTRICT e, C4eAlgo32Digit tmp[C4E_RESTRICT]) |
Public RSA key validity test. |
#define C4E_RSA_TMP_NUM | ( | tmpid, | |||
keylen | ) |
Calculate the number of temp. space elements of type C4eAlgo32Digit for RSA algorithms.
Calculates the number of C4eAlgo32Digit elements from the RSA field size (in bytes).
For dynamic memory allocation the recommended usage is:
C4E_RSA_TMP_NUM(C4E_RSA_TMPID_PKCS1_WORSTCASE, dom->m.len)
with C4E_RSA_TMPID_PKCS1_WORSTCASE as an example. For static memory reservation it might be used as:
in case C4E_DLC_GF_BYTES_MAX is defined.
keylen
should be a constant. In this case the compiler calculates the return value.[in] | tmpid | Temp. space qualifier associated with the function, for which finally memory space shall be allocated. Pass in here one of the defines from RSA Temp. Space Qualifiers. |
[in] | keylen | Key length (field size, in bytes) for which the number of C4eAlgo32Digit array elements has to be calculated. |
#define C4E_RSA_PKCS1V1_EBOH |
Minimum encoding overhead in a PKCS #1 v1.5 respective PEM (RFC 1423) encryption block, in bytes.
The minimal overhead in encryption block EB is based on the following structure:
00 || BT || PS || 00, with sizeof(PS) >= 8
. In the special case that the encryption data length is zero, this value defines the minimum size of RSA modulus (as indicated in member m.len of C4eDlcDomain).
#define C4E_RSA_OAEP_EMOH | ( | hlen | ) |
Minimum encryption overhead in a PKCS #1 v2.1 EME-OAEP encoded message, in bytes.
The minimal overhead in encoded message EM is based on the following OAEP structure:
0x00 || seed || lhash || 0x01
. In the special case that the encryption data length is zero, this value defines the minimum size of RSA modulus (as indicated in member m.len of C4eDlcDomain).
[in] | hlen | Digest length (in bytes) of used hash algorithm. |
#define C4E_RSA_PSS_EMLEN | ( | hlen, | |||
slen | ) |
Length of a PKCS #1 v2.1 EMSA-PSS (signature) encoded message, in bytes.
The length of encoded message EM is based on the following structure:
maskedDB || H || 0xBC
, with
maskedDB ::= PS || 0x01 || salt
. In the special case that the salt length is zero, the return value defines the minimum size of RSA modulus (as indicated in member m.len of C4eDlcDomain). If you set argument slen
to zero, then the expression
dom->m.len - C4E_RSA_PSS_EMLEN(hlen, 0)
determines the maximum allowed length for the EMSA-PSS salt.
C4E_ARCH_DIGIT_SIZE
and the type C4eAlgo32Uint), which may be greater than the returned value - especially if the salt length is small. Because all signature routines check the size of RSA key at function entry, application of this macro at user-side is normally not needed.[in] | hlen | Digest length (in bytes) of used hash algorithm. |
[in] | slen | Length of salt (in bytes) to be used. Set this to zero to get the absolutely minimum. |
C4eSysStatus c4e_rsa_encrypt_pkcs1v1 | ( | C4eDlcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eElement *C4E_RESTRICT | e, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | plain, | |||
C4eArchSize | len, | |||
C4eAlgo32Digit | tmp[C4E_RESTRICT], | |||
C4eArchUint8 *C4E_RESTRICT | cipher | |||
) |
RSA encryption of a plaintext octet string into a ciphertext octet string, compatible with PKCS #1 v1.5 (block type 2) and Privacy Enhancement for Internet Electronic Mail (PEM).
dom->m.val
is temporary modified - so it must be writable. After function return it holds the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). e
must be assured by the caller, for example by using function c4e_rsa_keychk_pub(). tmp
[], using macro C4E_RSA_TMP_NUM() to calculate the number of elements. The following temp. space qualifiers are intended for that purpose:
[in] | dom | Pointer to domain parameters. |
[in] | e | Pointer to RSA public key. |
[in] | plain | Plaintext octet string, which shall be encrypted. |
[in] | len | Length of plain text octet string in bytes. |
tmp | Array of temporary space elements (see preconditions for details on size). | |
[out] | cipher | Ciphertext octet string result, with implicit length of dom->m.len bytes. |
C4E_STATUS_OK | If the operation was successful. | |
other | If the operation has failed. |
C4eSysStatus c4e_rsa_decrypt_pkcs1v1 | ( | C4E_CONST C4eDlcDomain *C4E_RESTRICT | dom, | |
C4eRsaKeyPrv * | key, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | cipher, | |||
C4eAlgo32Digit | tmp[C4E_RESTRICT], | |||
C4eArchUint8 *C4E_RESTRICT | plain, | |||
C4eArchSize *C4E_RESTRICT | plen | |||
) |
RSA decryption of a ciphertext octet string into a plain- text octet string, compatible with PKCS #1 v1.5 (block type 2) and Privacy Enhancement for Internet Electronic Mail (PEM).
The RSA algorithm is based on modular exponentiation of big integer numbers. In case of decryption the expression transforms the cipher variable into a plaintext number . This implementation uses the Chinese Remainder Theorem (CRT) in the following form:
key->p
and key->q
are temporary modified - so they must be writable. After function return these members have the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). key
must be assured by the caller, either implicit or by using function c4e_rsa_keychk_prv(). tmp
[], using macro C4E_RSA_TMP_NUM() to calculate the number of elements. The following temp. space qualifiers are intended for that purpose:[in] | dom | Pointer to domain parameters. |
[in] | key | Pointer to RSA private key. |
[in] | cipher | Ciphertext octet string, which shall be decrypted. |
tmp | Array of temporary space elements (see preconditions for details on size). | |
[out] | plain | Plaintext octet string result of length *plen . |
[in,out] | plen | Pointer to length variable which must be set to the length of cipher octet string (input) and returns the real length of plain (output) in bytes. |
C4E_STATUS_OK | If the operation was successful. | |
other | If the operation has failed. |
C4eSysStatus c4e_rsa_sign_pkcs1v1 | ( | C4E_CONST C4eDlcDomain *C4E_RESTRICT | dom, | |
C4eRsaKeyPrv * | key, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | digest, | |||
C4eAlgo32Digit | tmp[C4E_RESTRICT], | |||
C4eArchUint8 *C4E_RESTRICT | signature | |||
) |
RSA signature of a digest, compatible with PKCS #1 v1.5 (block type 1).
The RSA algorithm is based on modular exponentiation of big integer numbers. In case of a signature the expression transforms a PKCS #1 v1.5 encoded digest into a signature . This implementation uses the Chinese Remainder Theorem (CRT) in the following form:
key->p
and key->q
are temporary modified - so they must be writable. After function return these members have the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). key
must be assured by the caller, either implicit or by using function c4e_rsa_keychk_prv(). tmp
[], using macro C4E_RSA_TMP_NUM() to calculate the number of elements. The following temp. space qualifiers are intended for that purpose:[in] | dom | Pointer to domain parameters. |
[in] | key | Pointer to RSA private key. |
[in] | hid | Hash algorithm identifier of type C4eHashId. |
[in] | digest | Digest calculated by the caller using one of the hash functions enumerated in C4eHashId, here identified by hid . The length of digest is implicit:
|
tmp | Array of temporary space elements (see preconditions for details on size). | |
[out] | signature | Signature (octet string), with implicit length of dom->m.len bytes. |
C4E_STATUS_OK | If the operation was successful. | |
other | If the operation has failed. |
C4eSysStatus c4e_rsa_verify_pkcs1v1 | ( | C4eDlcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eElement *C4E_RESTRICT | e, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | digest, | |||
C4eAlgo32Digit | tmp[C4E_RESTRICT], | |||
C4eArchUint8 *C4E_RESTRICT | signature, | |||
C4eArchSize | len | |||
) |
PKCS #1 v1.5 (block type 1) RSA signature verification.
The RSA algorithm is based on modular exponentiation of big integer numbers. In case of a signature verification the expression transforms a PKCS #1 v1.5 signature back to the original digest , which then is compared against parameter digest
.
dom->m.val
is temporary modified - so it must be writable. After function return it holds the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). e
must be assured by the caller, for example by using function c4e_rsa_keychk_pub(). tmp
[], using macro C4E_RSA_TMP_NUM() to calculate the number of elements. The following temp. space qualifiers are intended for that purpose:
[in] | dom | Pointer to domain parameters. |
[in] | e | Pointer to RSA public key. |
[in] | hid | Hash algorithm identifier of type C4eHashId. |
[in] | digest | Digest calculated by the caller, using the hash function associated with hid . The length of digest is implicit:
|
tmp | Array of temporary space elements (see preconditions for details on size). | |
[in,out] | signature | Signature to be verified (input). As output it holds the ASN.1 BER (DER) encoded DigestInfo defined in PKCS #1 v1.5 (which only is of interest in special applications). |
[in] | len | Length of signature in bytes. |
C4E_STATUS_OK | If the signature is valid. | |
other | If the signature verification has failed. |
C4eSysStatus c4e_rsa_encrypt_pkcs1v2 | ( | C4eDlcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eElement *C4E_RESTRICT | e, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | plain, | |||
C4eArchSize | len, | |||
C4eAlgo32Digit | tmp[C4E_RESTRICT], | |||
C4eArchUint8 *C4E_RESTRICT | cipher | |||
) |
RSA encryption of a plaintext octet string into a ciphertext octet string, compatible with PKCS #1 v2.1 (RSAES-OAEP), IEEE Std 1363 (IFES/EME1) and ISO 18033-2 (RSAES/REM1).
This type of RSA encoding scheme uses Optimal Asymmetric Encryption Padding (OAEP) with Mask Generation Function MGF1 and an empty label.
dom->m.val
is temporary modified - so it must be writable. After function return it holds the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). e
must be assured by the caller, for example by using function c4e_rsa_keychk_pub(). tmp
[], using macro C4E_RSA_TMP_NUM() to calculate the number of elements. The following temp. space qualifiers are intended for that purpose:
[in] | dom | Pointer to domain parameters. |
[in] | e | Pointer to RSA public key. |
[in] | hid | Hash algorithm identifier. |
[in] | plain | Plaintext octet string, which shall be encrypted. |
[in] | len | Length of plain text octet string in bytes. |
tmp | Array of temporary space elements (see preconditions for details on size). | |
[out] | cipher | Ciphertext octet string result, with implicit length of dom->m.len bytes. But notice that 4 extra bytes are used temporary after end of cipher . |
C4E_STATUS_OK | If the operation was successful. | |
other | If the operation has failed. |
C4eSysStatus c4e_rsa_decrypt_pkcs1v2 | ( | C4E_CONST C4eDlcDomain *C4E_RESTRICT | dom, | |
C4eRsaKeyPrv * | key, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | cipher, | |||
C4eAlgo32Digit | tmp[C4E_RESTRICT], | |||
C4eArchUint8 *C4E_RESTRICT | plain, | |||
C4eArchSize *C4E_RESTRICT | plen | |||
) |
RSA decryption of a ciphertext octet string into a plain- text octet string, compatible with PKCS #1 v2.1 (RSAES- OAEP), IEEE Std 1363 (IFES/EME1) and ISO 18033-2 (RSAES/REM1).
This type of RSA encoding scheme uses Optimal Asymmetric Encryption Padding (OAEP) with Mask Generation Function MGF1 and an empty label.
key->p
and key->q
are temporary modified - so they must be writable. After function return these members have the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). key
must be assured by the caller, either implicit or by using function c4e_rsa_keychk_prv(). tmp
[], using macro C4E_RSA_TMP_NUM() to calculate the number of elements. The following temp. space qualifiers are intended for that purpose:[in] | dom | Pointer to domain parameters. |
[in] | key | Pointer to RSA private key. |
[in] | hid | Hash algorithm identifier. |
[in] | cipher | Ciphertext octet string, which shall be decrypted. |
tmp | Array of temporary space elements (see preconditions for details on size). | |
[out] | plain | Plaintext octet string result of length *plen . The maximum length is dom->m.len bytes. But notice that 4 extra bytes are used temporary after end of plain . |
[in,out] | plen | Pointer to length variable which must be set to the length of cipher octet string (input) and returns the real length of plain (output) in bytes. |
C4E_STATUS_OK | If the operation was successful. | |
other | If the operation has failed. |
C4eSysStatus c4e_rsa_sign_pkcs1v2 | ( | C4E_CONST C4eDlcDomain *C4E_RESTRICT | dom, | |
C4eRsaKeyPrv * | key, | |||
C4eArchSize | slen, | |||
C4eHashId | hid, | |||
C4E_CONST C4eArchUint8 *C4E_RESTRICT | digest, | |||
C4eAlgo32Digit | tmp[C4E_RESTRICT], | |||
C4eArchUint8 *C4E_RESTRICT | signature | |||
) |
RSA signature of a digest, compatible with PKCS #1 v2.1 signature scheme RSASSA-PSS.
The RSA algorithm is based on modular exponentiation of big integer numbers. In case of a signature the expression transforms a PKCS #1 v2.1 EMSA-PSS (Probabilistic Signature Scheme) encoded digest into a signature . This implementation uses the Chinese Remainder Theorem (CRT) in the following form:
hlen
, slen
), with hlen
for example C4E_SHA256_DIGEST_LEN. For SHA-1/224/256 this means: the minimum modulus without any salt would be in theory at 176/240/272 bit, but the absolute minimum in this implementation is at 200-312 bit (depending on hash algorithm, C4E_ARCH_DIGIT_SIZE
and the real type of C4eAlgo32Digit). salt
, the more the complexity of this scheme is near the theoretical difficulty of inverting the RSA algorithm (see IEEE Std 1363a-2004 for details).key->p
and key->q
are temporarily modified - so they must be writable. After function return these members have the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). key
must be assured by the caller, either implicit or by using function c4e_rsa_keychk_prv(). tmp
[], using macro C4E_RSA_TMP_NUM() to calculate the number of elements. The following temp. space qualifiers are intended for that purpose:[in] | dom | Pointer to domain parameters. |
[in] | key | Pointer to RSA private key. |
[in] | slen | Length of salt (random used in EMSA-PSS), which must be less than
dom->m.len - C4E_RSA_PSS_EMLEN(hlen, 0) with |
[in] | hid | Hash algorithm identifier of type C4eHashId. |
[in] | digest | Digest calculated by the caller using one of the hash functions enumerated in C4eHashId, here identified by hid . The length of digest is implicit:
|
tmp | Array of temporary space elements (see preconditions for details on size). | |
[out] | signature | Signature (octet string), with implicit length of dom->m.len bytes. But notice that 6 extra bytes are used temporary after the end of signature . The caller must ensure that this additional memory space is available. |
C4E_STATUS_OK | If the operation was successful. | |
other | If the operation has failed. |
C4eSysStatus c4e_rsa_verify_pkcs1v2 | ( | C4eDlcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eElement *C4E_RESTRICT | e, | |||
C4eHashId | hid, | |||
C4eArchUint8 *C4E_RESTRICT | digest, | |||
C4eArchUint8 *C4E_RESTRICT | signature, | |||
C4eArchSize | len, | |||
C4eAlgo32Digit | tmp[C4E_RESTRICT] | |||
) |
PKCS #1 v2.1 RSA signature verification, according to scheme RSASSA-PSS.
The RSA algorithm is based on modular exponentiation of big integer numbers. In case of a signature verification the expression transforms a PKCS #1 v2.1 signature back to the encoded digest , which then is decoded and compared against parameter digest
.
dom->m.val
is temporary modified - so it must be writable. After function return it holds the same values as at function entry.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). e
must be assured by the caller, for example by using function c4e_rsa_keychk_pub(). len
indicates the length of signature
, there must be enough space for dom->m.len
+ 6 bytes in signature
. tmp
[], using macro C4E_RSA_TMP_NUM() to calculate the number of elements. The following temp. space qualifiers are intended for that purpose:
[in] | dom | Pointer to domain parameters. |
[in] | e | Pointer to RSA public key. |
[in] | hid | Hash algorithm identifier of type C4eHashId. |
[in] | digest | Digest calculated by the caller, using the hash function associated with hid . The length of digest is implicit:
|
[in] | signature | Signature to be verified (destroyed). Notice the preconditions on memory space for this buffer. |
[in] | len | Length of signature in bytes. |
tmp | Array of temporary space elements (see preconditions for details on size). |
C4E_STATUS_OK | If the signature is valid. | |
other | If the signature verification has failed. |
C4eSysStatus c4e_rsa_keychk_prv | ( | C4E_CONST C4eDlcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eRsaKeyPrv *C4E_RESTRICT | key, | |||
C4eAlgo32Digit | tmp[C4E_RESTRICT] | |||
) |
Private RSA key validity test.
This function performs basic tests on a RSA private key, which:
associated with a RSA private key.
dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). tmp
[], using macro C4E_RSA_TMP_NUM() in conjunction with temp. space qualifier C4E_RSA_TMPID_KEY_CHECK. key
must be normalized, e.g. by using functions c4e_elem_norm() or c4e_elem_os2e().[in] | dom | Pointer to domain parameters. |
[in] | key | Pointer to RSA private key to be tested. |
tmp | Array of temporary space elements (see preconditions for details on size). |
key
. C4E_STATUS_OK | If the key seems to be valid. | |
other | If the key is invalid. |
C4eSysStatus c4e_rsa_keychk_pub | ( | C4E_CONST C4eDlcDomain *C4E_RESTRICT | dom, | |
C4E_CONST C4eElement *C4E_RESTRICT | e, | |||
C4eAlgo32Digit | tmp[C4E_RESTRICT] | |||
) |
Public RSA key validity test.
This function performs basic tests on a RSA public key e
, which ensures proper working of all RSA functions:
e
must be greater than 1 and less than modulus dom->m.val
;e
must be odd.dom
must be assured by the caller, either implicit or by using function c4e_dlc_domchk(). key
must be normalized, e.g. by using functions c4e_elem_norm() or c4e_elem_os2e().[in] | dom | Pointer to domain parameters. |
[in] | e | Pointer to RSA public key, to be tested. |
tmp | Array of temporary space elements ( (unused at the moment) |
key
. C4E_STATUS_OK | If the key seems to be valid. | |
other | If the key is invalid. |