Function crypto_wasi::generate_key_pair
source · pub fn generate_key_pair(
algorithm: &str
) -> Result<(PublicKey, PrivateKey), CryptoErrno>
Expand description
Generates a new asymmetric key pair of the given algorithm
Unlike nodejs, it cannot directly specify the export parameter
and please use the PublicKey::export()
and PrivateKey::export()
function
Supported algorithm list:
- “ECDSA_P256_SHA256” prime256v1 (curve name used in nodejs)
- “ECDSA_K256_SHA256” secp256k1
- “ECDSA_P384_SHA384” secp384r1
- “ED25519”
- “RSA_PKCS1_2048_SHA256”
- “RSA_PKCS1_2048_SHA384”
- “RSA_PKCS1_2048_SHA512”
- “RSA_PKCS1_3072_SHA384”
- “RSA_PKCS1_3072_SHA512”
- “RSA_PKCS1_4096_SHA512”
- “RSA_PSS_2048_SHA256”
- “RSA_PSS_2048_SHA384”
- “RSA_PSS_2048_SHA512”
- “RSA_PSS_3072_SHA384”
- “RSA_PSS_3072_SHA512”
- “RSA_PSS_4096_SHA512”