|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
Go to the source code of this file.
Data Structures | |
| struct | SharkSslPSAEcdsaKey |
| A volatile PSA key owned by this context Initialize once, then destroy before reusing it Signatures are fixed-width raw r||s Private signing keys can verify directly or through a temporary public PSA handle. More... | |
Typedefs | |
| typedef struct SharkSslPSAEcdsaKey | SharkSslPSAEcdsaKey |
| A volatile PSA key owned by this context Initialize once, then destroy before reusing it Signatures are fixed-width raw r||s Private signing keys can verify directly or through a temporary public PSA handle. More... | |
Functions | |
| SHARKSSL_API int | SharkSslPSAEcdsaKey_generate (SharkSslPSAEcdsaKey *o, U16 curveID, psa_algorithm_t hashAlg, int deterministic) |
| Generate a volatile private key through the selected PSA provider. More... | |
| SHARKSSL_API int | SharkSslPSAEcdsaKey_importPrivate (SharkSslPSAEcdsaKey *o, U16 curveID, psa_algorithm_t hashAlg, int deterministic, const U8 *privateKey, U16 privateKeyLen) |
| Import a private key into an owned volatile PSA handle. More... | |
| SHARKSSL_API int | SharkSslPSAEcdsaKey_importPublic (SharkSslPSAEcdsaKey *o, U16 curveID, psa_algorithm_t hashAlg, int deterministic, const U8 *publicKey, U16 publicKeyLen) |
| Import a public verification/encryption key into a volatile PSA handle. More... | |
| SHARKSSL_API int | SharkSslPSAEcdsaKey_exportPublic (const SharkSslPSAEcdsaKey *o, U8 *publicKey, U16 publicKeySize, U16 *publicKeyLen) |
| Export the public key without transferring handle ownership. More... | |
| SHARKSSL_API int | SharkSslPSAEcdsaKey_signRaw (const SharkSslPSAEcdsaKey *o, const U8 *hash, U16 hashLen, U8 *signature, U16 signatureSize, U16 *signatureLen) |
| Sign a digest and return fixed-width raw ECDSA r||s. More... | |
| SHARKSSL_API int | SharkSslPSAEcdsaKey_verifyRaw (const SharkSslPSAEcdsaKey *o, const U8 *hash, U16 hashLen, const U8 *signature, U16 signatureLen) |
| Verify a fixed-width raw ECDSA r||s signature over a digest. More... | |
| SHARKSSL_API int | SharkSslPSAEcdsa_rawToDer (U16 curveID, const U8 *raw, U16 rawLen, U8 *der, U16 derSize, U16 *derLen) |
| Convert an ECDSA signature from raw r||s to DER. More... | |
| SHARKSSL_API int | SharkSslPSAEcdsa_derToRaw (U16 curveID, const U8 *der, U16 derLen, U8 *raw, U16 rawSize, U16 *rawLen) |
| Convert an ECDSA signature from DER to raw r||s. More... | |
| SHARKSSL_API int | SharkSslASN1Create_CSRWithPSAECDSAKey (struct SharkSslASN1Create *o, const SharkSslPSAEcdsaKey *key, struct SharkSslCertDN *certDN, const char *SAN, struct SharkSslBitExtReq *keyUsage, struct SharkSslBitExtReq *nsCertType) |
| Create a PKCS#10 CSR using a private P-256, P-384, or P-521 PSA handle The handle must permit ECDSA signing with SHA-256, SHA-384, or SHA-512. More... | |
| SHARKSSL_API int | SharkSslASN1Create_CSRWithPSAECDSAKeyHash (struct SharkSslASN1Create *o, const SharkSslPSAEcdsaKey *key, struct SharkSslCertDN *certDN, const char *SAN, struct SharkSslBitExtReq *keyUsage, struct SharkSslBitExtReq *nsCertType, U8 hashID) |
| Select a concrete digest when the signing key permits ECDSA(ANY_HASH). More... | |
| SHARKSSL_API int | SharkSslPSAEcdsaKey_destructor (SharkSslPSAEcdsaKey *o) |
| Destroy the owned volatile PSA key and clear the context. More... | |
See Choose a SharkSSL API for build scope and the owning API layer.
| typedef struct SharkSslPSAEcdsaKey SharkSslPSAEcdsaKey |
A volatile PSA key owned by this context Initialize once, then destroy before reusing it Signatures are fixed-width raw r||s Private signing keys can verify directly or through a temporary public PSA handle.
| int SharkSslASN1Create_CSRWithPSAECDSAKey | ( | struct SharkSslASN1Create * | o, |
| const SharkSslPSAEcdsaKey * | key, | ||
| struct SharkSslCertDN * | certDN, | ||
| const char * | SAN, | ||
| struct SharkSslBitExtReq * | keyUsage, | ||
| struct SharkSslBitExtReq * | nsCertType | ||
| ) |
Create a PKCS#10 CSR using a private P-256, P-384, or P-521 PSA handle The handle must permit ECDSA signing with SHA-256, SHA-384, or SHA-512.
This creates a request, not an issued certificate.
Inputs and the private key remain owned by the caller. Supported CSR curves are P-256, P-384, and P-521. The non-Hash form derives the hash from the key algorithm; ANY_HASH requires the Hash form.
| o | SharkSslASN1Create *; required freshly initialized writer with an empty caller-owned buffer (ptr=end). Retrieve the resulting DER with SharkSslASN1Create_getDataLen. |
| key | const SharkSslPSAEcdsaKey *; 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. |
| int SharkSslASN1Create_CSRWithPSAECDSAKeyHash | ( | struct SharkSslASN1Create * | o, |
| const SharkSslPSAEcdsaKey * | key, | ||
| struct SharkSslCertDN * | certDN, | ||
| const char * | SAN, | ||
| struct SharkSslBitExtReq * | keyUsage, | ||
| struct SharkSslBitExtReq * | nsCertType, | ||
| U8 | hashID | ||
| ) |
Select a concrete digest when the signing key permits ECDSA(ANY_HASH).
This creates a request, not an issued certificate.
The key must allow SIGN_HASH for the selected digest; ANY_HASH is never passed as an operation algorithm.
Inputs and the private key remain owned by the caller. Supported CSR curves are P-256, P-384, and P-521. The non-Hash form derives the hash from the key algorithm; ANY_HASH requires the Hash form.
| o | SharkSslASN1Create *; required freshly initialized writer with an empty caller-owned buffer (ptr=end). Retrieve the resulting DER with SharkSslASN1Create_getDataLen. |
| key | const SharkSslPSAEcdsaKey *; 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. |
| hashID | U8; enabled SHARKSSL_HASHID_SHA256, SHARKSSL_HASHID_SHA384, or SHARKSSL_HASHID_SHA512 matching the key's ECDSA policy (or ANY_HASH). |