|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
#include "SharkSSL.h"Go to the source code of this file.
Data Structures | |
| struct | SharkSslPSARSAKey |
| An RSA key owned by the external PSA provider. More... | |
Typedefs | |
| typedef struct SharkSslPSARSAKey | SharkSslPSARSAKey |
| An RSA key owned by the external PSA provider. More... | |
Functions | |
| SHARKSSL_API int | SharkSslPSARSAKey_generate (SharkSslPSARSAKey *o, psa_algorithm_t alg, int exportable, U16 bits) |
| SHARKSSL_API int | SharkSslPSARSAKey_importPrivate (SharkSslPSARSAKey *o, const U8 *privateDer, psa_algorithm_t alg, int exportable, U16 privateDerLen) |
| SHARKSSL_API int | SharkSslPSARSAKey_importPublic (SharkSslPSARSAKey *o, const U8 *publicDer, psa_algorithm_t alg, U16 publicDerLen) |
| SHARKSSL_API int | SharkSslPSARSAKey_exportPrivate (const SharkSslPSARSAKey *o, U8 *privateDer, U16 privateDerSize, U16 *privateDerLen) |
| SHARKSSL_API int | SharkSslPSARSAKey_exportPublic (const SharkSslPSARSAKey *o, U8 *publicDer, U16 publicDerSize, U16 *publicDerLen) |
| SHARKSSL_API int | SharkSslPSARSAKey_encrypt (const SharkSslPSARSAKey *o, const U8 *plaintext, const U8 *label, U8 *ciphertext, U16 plaintextLen, U16 labelLen, U16 ciphertextSize, U16 *ciphertextLen) |
| SHARKSSL_API int | SharkSslPSARSAKey_decrypt (const SharkSslPSARSAKey *o, const U8 *ciphertext, const U8 *label, U8 *plaintext, U16 ciphertextLen, U16 labelLen, U16 plaintextSize, U16 *plaintextLen) |
| SHARKSSL_API int | SharkSslPSARSAKey_signHash (const SharkSslPSARSAKey *o, const U8 *hash, U8 *signature, U16 *signatureLen, U16 hashLen, U16 signatureSize) |
| SHARKSSL_API int | SharkSslPSARSAKey_verifyHash (const SharkSslPSARSAKey *o, const U8 *hash, const U8 *signature, U16 hashLen, U16 signatureLen) |
| SHARKSSL_API int | SharkSslASN1Create_CSRWithPSARSAKey (struct SharkSslASN1Create *o, const SharkSslPSARSAKey *key, struct SharkSslCertDN *certDN, const char *SAN, struct SharkSslBitExtReq *keyUsage, struct SharkSslBitExtReq *nsCertType) |
| Create a PKCS#10 CSR with a non-exportable RSA private key The key policy must select PKCS#1 v1.5 or standard-salt PSS with SHA-256, SHA-384, or SHA-512 The public key is exported from the same PSA handle. More... | |
| SHARKSSL_API int | SharkSslPSARSAKey_destructor (SharkSslPSARSAKey *o) |
See Choose a SharkSSL API for build scope and the owning API layer.
| typedef struct SharkSslPSARSAKey SharkSslPSARSAKey |
An RSA key owned by the external PSA provider.
Algorithm is either PSA_ALG_RSA_PKCS1V15_CRYPT, PSA_ALG_RSA_OAEP(hash), PSA_ALG_RSA_PKCS1V15_SIGN(hash), or PSA_ALG_RSA_PSS(hash) with standard salt length Private keys may be non-exportable; the public key can always be exported A signing key can verify with its private handle when the provider supports it Otherwise, verification uses a temporary public handle Initialize once, then call destructor before reusing this context
| int SharkSslASN1Create_CSRWithPSARSAKey | ( | struct SharkSslASN1Create * | o, |
| const SharkSslPSARSAKey * | key, | ||
| struct SharkSslCertDN * | certDN, | ||
| const char * | SAN, | ||
| struct SharkSslBitExtReq * | keyUsage, | ||
| struct SharkSslBitExtReq * | nsCertType | ||
| ) |
Create a PKCS#10 CSR with a non-exportable RSA private key The key policy must select PKCS#1 v1.5 or standard-salt PSS with SHA-256, SHA-384, or SHA-512 The public key is exported from the same PSA handle.
This creates a request, not an issued certificate.
Inputs and the private key remain owned by the caller.
| o | SharkSslASN1Create *; required freshly initialized writer with an empty caller-owned buffer (ptr=end). Retrieve the resulting DER with SharkSslASN1Create_getDataLen. |
| key | const SharkSslPSARSAKey *; required live private signing-key context, borrowed for the call; public-only keys are rejected. |
| certDN | SharkSslCertDN *; required subject distinguished name, borrowed for the call. |
| SAN | const char *; optional NUL-terminated SAN string using SharkSslASN1Create_CSR syntax; NULL omits this extension. |
| keyUsage | SharkSslBitExtReq *; optional requested key-usage extension, or NULL. |
| nsCertType | SharkSslBitExtReq *; optional Netscape certificate-type extension, or NULL. |
| SHARKSSL_API int SharkSslPSARSAKey_decrypt | ( | const SharkSslPSARSAKey * | o, |
| const U8 * | ciphertext, | ||
| const U8 * | label, | ||
| U8 * | plaintext, | ||
| U16 | ciphertextLen, | ||
| U16 | labelLen, | ||
| U16 | plaintextSize, | ||
| U16 * | plaintextLen | ||
| ) |
| SHARKSSL_API int SharkSslPSARSAKey_destructor | ( | SharkSslPSARSAKey * | o | ) |
| SHARKSSL_API int SharkSslPSARSAKey_encrypt | ( | const SharkSslPSARSAKey * | o, |
| const U8 * | plaintext, | ||
| const U8 * | label, | ||
| U8 * | ciphertext, | ||
| U16 | plaintextLen, | ||
| U16 | labelLen, | ||
| U16 | ciphertextSize, | ||
| U16 * | ciphertextLen | ||
| ) |
| SHARKSSL_API int SharkSslPSARSAKey_exportPrivate | ( | const SharkSslPSARSAKey * | o, |
| U8 * | privateDer, | ||
| U16 | privateDerSize, | ||
| U16 * | privateDerLen | ||
| ) |
| SHARKSSL_API int SharkSslPSARSAKey_exportPublic | ( | const SharkSslPSARSAKey * | o, |
| U8 * | publicDer, | ||
| U16 | publicDerSize, | ||
| U16 * | publicDerLen | ||
| ) |
| SHARKSSL_API int SharkSslPSARSAKey_generate | ( | SharkSslPSARSAKey * | o, |
| psa_algorithm_t | alg, | ||
| int | exportable, | ||
| U16 | bits | ||
| ) |
| SHARKSSL_API int SharkSslPSARSAKey_importPrivate | ( | SharkSslPSARSAKey * | o, |
| const U8 * | privateDer, | ||
| psa_algorithm_t | alg, | ||
| int | exportable, | ||
| U16 | privateDerLen | ||
| ) |
| SHARKSSL_API int SharkSslPSARSAKey_importPublic | ( | SharkSslPSARSAKey * | o, |
| const U8 * | publicDer, | ||
| psa_algorithm_t | alg, | ||
| U16 | publicDerLen | ||
| ) |
| SHARKSSL_API int SharkSslPSARSAKey_signHash | ( | const SharkSslPSARSAKey * | o, |
| const U8 * | hash, | ||
| U8 * | signature, | ||
| U16 * | signatureLen, | ||
| U16 | hashLen, | ||
| U16 | signatureSize | ||
| ) |
| SHARKSSL_API int SharkSslPSARSAKey_verifyHash | ( | const SharkSslPSARSAKey * | o, |
| const U8 * | hash, | ||
| const U8 * | signature, | ||
| U16 | hashLen, | ||
| U16 | signatureLen | ||
| ) |