x509 API.
Authors: Alexander Færøy (ahf@0x90.dk
).
options() = #{public_key => onion_rsa:public_key(), valid_from => calendar:datetime(), valid_to => calendar:datetime(), subject => [{subject(), term()}], issuer => [{subject(), term()}], version => v1 | v2 | v3, serial => non_neg_integer(), digest => sha | sha256 | sha384 | sha512 | md5}
subject() = name | email | city | state | org | org_unit | country | serial | title | dnQualifier
create_certificate/1 | |
der_decode/1 | |
der_encode/1 | |
is_self_signed/1 | |
not_after/1 | |
not_before/1 | |
public_key/1 | |
sign/2 | |
verify/2 |
create_certificate(Options) -> {ok, Certificate} | {error, Reason}
Options = options()
Certificate = public_key:der_encoded()
Reason = term()
der_decode(CertificateDer) -> {ok, Certificate} | {error, Reason}
CertificateDer = public_key:der_encoded()
Certificate = term()
Reason = term()
der_encode(Certificate) -> {ok, CertificateDer} | {error, Reason}
Certificate = #OTPTBSCertificate{}
CertificateDer = public_key:der_encoded()
Reason = term()
is_self_signed(Certificate) -> boolean()
Certificate = #OTPTBSCertificate{} | public_key:der_encoded()
not_after(Certificate) -> calendar:datetime()
Certificate = #OTPTBSCertificate{} | public_key:der_encoded()
not_before(Certificate) -> calendar:datetime()
Certificate = #OTPTBSCertificate{} | public_key:der_encoded()
public_key(Certificate) -> {ok, onion_rsa:public_key()} | {error, Reason}
Certificate = #OTPTBSCertificate{} | public_key:der_encoded()
Reason = term()
sign(Certificate, SecretKey) -> CertificateDer
Certificate = #OTPTBSCertificate{}
SecretKey = onion_rsa:secret_key()
CertificateDer = public_key:der_encoded()
verify(CertificateDer, Key) -> boolean()
CertificateDer = public_key:der_encoded()
Key = onion_rsa:key()