from_pem_opts() = [{password, string() | binary()}]
new_rsa_opts() = [{exponent, non_neg_integer()}]
private_key() = public_key:rsa_private_key() | public_key:ec_private_key()
private_key_info() = #'PrivateKeyInfo'{}
to_der_opts() = [{wrap, boolean()}]
to_pem_opts() = [{wrap, boolean()} | {password, string()} | {cipher, public_key:cipher()}]
from_der/1 | Attempts to parse a private key in DER (binary) format. |
from_pem/1 | Attempts to parse a private key in PEM format. |
from_pem/2 | Attempts to parse a private key in PEM format. |
new_ec/1 | Generates a new private EC private key. |
new_rsa/1 | Generates a new private RSA private key. |
new_rsa/2 | Generates a new private RSA private key. |
to_der/1 | Converts a private key to DER (binary) format. |
to_der/2 | Converts a private key to DER (binary) format. |
to_pem/1 | Converts a private key to PEM format. |
to_pem/2 | Converts a private key to PEM format. |
unwrap/1 | Extracts a private key from a PKCS#8 PrivateKeyInfo container. |
wrap/1 | Wraps a private key in a PKCS#8 PrivateKeyInfo container. |
from_der(DER::binary()) -> {ok, private_key()} | {error, malformed}
Attempts to parse a private key in DER (binary) format. Unwraps a PKCS#8 PrivateKeyInfo container, if present.
Returns an 'ok' tuple in case of success, or an 'error' tuple in case of failure. Possible error reasons are:
from_pem(PEM::binary()) -> {ok, private_key()} | {error, not_found | malformed}
Attempts to parse a private key in PEM format.
Equivalent tofrom_pem(PEM, [])
.
from_pem(PEM::binary(), Opts::from_pem_opts()) -> {ok, private_key()} | {error, not_found | malformed}
Attempts to parse a private key in PEM format. Unwraps a PKCS#8 PrivateKeyInfo container, if present.
Expects the input string to include at least one of the following PEM entry types: "PRIVATE KEY", "EC PRIVATE KEY" or "RSA PRIVATE KEY". Use 'from_pem/2' for password-protected PEM entries.
If the PEM entry is password protected, the 'password' option must be specified to decrypt the private key.
Returns an 'ok' tuple in case of success, or an 'error' tuple in case of failure. Possible error reasons are:
new_ec(Curve::crypto:ec_named_curve() | public_key:oid()) -> public_key:ec_private_key()
Generates a new private EC private key. The curve can be specified as an atom or an OID tuple.
To derive the public key, use x509_public_key:derive/1
.
new_rsa(KeySize::non_neg_integer()) -> public_key:rsa_private_key()
Generates a new private RSA private key.
Equivalent to new_rsa(KeySize, []).new_rsa(KeySize::non_neg_integer(), Opts::new_rsa_opts()) -> public_key:rsa_private_key()
Generates a new private RSA private key.
The key length in bits must be specified as an integer (minimum 256).
Options:
x509_public_key:derive/1
.
to_der(PrivateKey::private_key()) -> binary()
Converts a private key to DER (binary) format.
Equivalent to to_der(PrivateKey, []).to_der(PrivateKey::private_key(), Opts::to_der_opts()) -> binary()
Converts a private key to DER (binary) format.
Options:
to_pem(PrivateKey::private_key()) -> binary()
Converts a private key to PEM format.
Equivalent to to_pem(PrivateKey, []).to_pem(PrivateKey::private_key(), Opts::to_pem_opts()) -> binary()
Converts a private key to PEM format.
Options:
unwrap(Container::private_key_info()) -> private_key()
Extracts a private key from a PKCS#8 PrivateKeyInfo container.
wrap(PrivateKey::private_key()) -> private_key_info()
Wraps a private key in a PKCS#8 PrivateKeyInfo container.
Generated by EDoc