module

CrystalSaml::OpenSSLExt

Helper module for OpenSSL operations not covered by Crystal stdlib.

Instance methods

cert_fingerprint(pem : String, algorithm : String = "sha256") : String

Compute fingerprint of a PEM certificate.

Source
cert_public_key(pem : String) : LibCrypto::EVP_PKEY

Get the public key from a PEM certificate.

Source
cert_to_der(x509 : LibCrypto::X509) : Bytes

Get DER encoding of a certificate.

Source
parse_cert_pem(pem : String) : LibCrypto::X509

Parse a PEM certificate string into a LibCrypto X509 pointer.

Source
parse_private_key_pem(pem : String) : LibCrypto::EVP_PKEY

Parse a PEM private key.

Source
sign(private_key_pem : String, data : String, algorithm : String = "SHA256") : Bytes

Sign data using a private key with the given digest algorithm.

Source
verify(cert_pem : String, signature : Bytes, data : String, algorithm : String = "SHA256") : Bool

Verify a signature using a certificate's public key.

Source