This function initializes an RSA context.
This function imports core RSA parameters, in raw big-endian binary format, into an RSA context. Any sequence of calls to this function should be followed by a call to mbedtls_rsa_complete(), which checks and completes the provided information to a ready-for-use public or private RSA key.
This function completes an RSA context from a set of imported core parameters. To setup an RSA public key, precisely \p N and \p E must have been imported. To setup an RSA private key, sufficient information must be present for the other parameters to be derivable. The default implementation supports the following: Derive \p P, \p Q from \p N, \p D, \p E. Derive \p N, \p D from \p P, \p Q, \p E. Alternative implementations need not support these. If this function runs successfully, it guarantees that the RSA context can be used for RSA operations without the risk of failure or crash. \warning This function need not perform consistency checks for the imported parameters. In particular, parameters that are not needed by the implementation might be silently discarded and left unchecked. To check the consistency of the key material, see mbedtls_rsa_check_privkey().
This function exports the core parameters of an RSA key. If this function runs successfully, the non-NULL buffers pointed to by \p N, \p P, \p Q, \p D, and \p E are fully written, with additional unused space filled leading by zero Bytes. Possible reasons for returning #MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED: An alternative RSA implementation is in use, which stores the key externally, and either cannot or should not export it into RAM. A SW or HW implementation might not support a certain deduction. For example, \p P, \p Q from \p N, \p D, and \p E if the former are not part of the implementation. If the function fails due to an unsupported operation, the RSA context stays intact and remains usable.
This function exports core parameters of an RSA key in raw big-endian binary format. If this function runs successfully, the non-NULL buffers pointed to by \p N, \p P, \p Q, \p D, and \p E are fully written, with additional unused space filled leading by zero Bytes. Possible reasons for returning #MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED: An alternative RSA implementation is in use, which stores the key externally, and either cannot or should not export it into RAM. A SW or HW implementation might not support a certain deduction. For example, \p P, \p Q from \p N, \p D, and \p E if the former are not part of the implementation. If the function fails due to an unsupported operation, the RSA context stays intact and remains usable.
This function exports CRT parameters of a private RSA key.
This function sets padding for an already initialized RSA context. See mbedtls_rsa_init() for details.
This function retrieves the length of RSA modulus in Bytes.
This function generates an RSA keypair.
This function checks if a context contains at least an RSA public key. If the function runs successfully, it is guaranteed that enough information is present to perform an RSA public key operation using mbedtls_rsa_public().
This function checks if a context contains an RSA private key and perform basic consistency checks. \warning This function should catch accidental misconfigurations like swapping of parameters, but it cannot establish full trust in neither the quality nor the consistency of the key material that was used to setup the given RSA context: Consistency: Imported parameters that are irrelevant for the implementation might be silently dropped. If dropped, the current function does not have access to them, and therefore cannot check them. See mbedtls_rsa_complete(). If you want to check the consistency of the entire content of an PKCS1-encoded RSA private key, for example, you should use mbedtls_rsa_validate_params() before setting up the RSA context. Additionally, if the implementation performs empirical checks, these checks substantiate but do not guarantee consistency. Quality: This function is not expected to perform extended quality assessments like checking that the prime factors are safe. Additionally, it is the responsibility of the user to ensure the trustworthiness of the source of his RSA parameters, which goes beyond what is effectively checkable by the library.
This function checks a public-private RSA key pair. It checks each of the contexts, and makes sure they match.
This function performs an RSA public key operation.
This function performs an RSA private key operation. \warning It is deprecated and a security risk to not provide a PRNG here and thereby prevent the use of blinding. Future versions of the library may enforce the presence of a PRNG.
This function adds the message padding, then performs an RSA operation. It is the generic wrapper for performing a PKCS#1 encryption operation using the \p mode from the context. \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PRIVATE mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PUBLIC.
This function performs a PKCS#1 v1.5 encryption operation (RSAES-PKCS1-v1_5-ENCRYPT). \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PRIVATE mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PUBLIC.
This function performs a PKCS#1 v2.1 OAEP encryption operation (RSAES-OAEP-ENCRYPT). \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PRIVATE mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PUBLIC.
This function performs an RSA operation, then removes the message padding. It is the generic wrapper for performing a PKCS#1 decryption operation using the \p mode from the context. \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PUBLIC mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PRIVATE.
This function performs a PKCS#1 v1.5 decryption operation (RSAES-PKCS1-v1_5-DECRYPT). \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PUBLIC mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PRIVATE.
This function performs a PKCS#1 v2.1 OAEP decryption operation (RSAES-OAEP-DECRYPT). \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PUBLIC mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PRIVATE.
This function performs a private RSA operation to sign a message digest using PKCS#1. It is the generic wrapper for performing a PKCS#1 signature using the \p mode from the context. \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PUBLIC mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PRIVATE.
This function performs a PKCS#1 v1.5 signature operation (RSASSA-PKCS1-v1_5-SIGN). \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PUBLIC mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PRIVATE.
This function performs a PKCS#1 v2.1 PSS signature operation (RSASSA-PSS-SIGN). \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PUBLIC mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PRIVATE.
This function performs a public RSA operation and checks the message digest. This is the generic wrapper for performing a PKCS#1 verification using the mode from the context. \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PRIVATE mode. Future versions of the library are likely to remove the \p mode argument and have it set to #MBEDTLS_RSA_PUBLIC.
This function performs a PKCS#1 v1.5 verification operation (RSASSA-PKCS1-v1_5-VERIFY). \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PRIVATE mode. Future versions of the library are likely to remove the \p mode argument and have it set to #MBEDTLS_RSA_PUBLIC.
This function performs a PKCS#1 v2.1 PSS verification operation (RSASSA-PSS-VERIFY). The hash function for the MGF mask generating function is that specified in the RSA context. \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PRIVATE mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PUBLIC.
This function performs a PKCS#1 v2.1 PSS verification operation (RSASSA-PSS-VERIFY). The hash function for the MGF mask generating function is that specified in \p mgf1_hash_id.
This function copies the components of an RSA context.
This function frees the components of an RSA key.