P11ex.ECParam (p11ex v0.1.1)

This module provides functions to encode and decode elliptic curve parameters.

Summary

Functions

Encode ECParameters for a named curve. ECParameters is a DER-encoded ASN.1 structure that identifies a named curve and can be used as a value for the cka_ec_params attribute of a key template.

List of named curves supported by the library.

Functions

ec_params_from_named_curve(name)

@spec ec_params_from_named_curve(atom()) :: {:ok, binary()} | {:error, String.t()}

Encode ECParameters for a named curve. ECParameters is a DER-encoded ASN.1 structure that identifies a named curve and can be used as a value for the cka_ec_params attribute of a key template.

Examples

iex> P11ex.ECParam.ec_params_from_named_curve(:secp256r1)
{:ok, <<0x06, ...}

iex> P11ex.ECParam.ec_params_from_named_curve(:secp42r1)
{:error, "Unknown named curve: secp42r1"}

named_curves()

@spec named_curves() :: [atom()]

List of named curves supported by the library.