EasySSL v1.0.4 EasySSL View Source

EasySSL is a wrapper around Erlang’s :public_key module to make it far more friendly. It automatically processes OIDs for most X509v3 extensions and subject fields.

There are really only two functions of note - parse_der and parse_pem, which should have obvious functions.

Link to this section Summary

Functions

Takes in a binary (<<...>>) and returns a map of the parsed certificate

Takes in a string (or charlist) and returns a map of the parsed certificate

Link to this section Functions

Link to this function get_all_domain_names(cert, serialized_cert) View Source
Link to this function parse_der(certificate_der, opts \\ [all_domains: false, serialize: false]) View Source

Takes in a binary (<<...>>) and returns a map of the parsed certificate

Examples

# Pass in a binary (from Base.decode64, or some other source)
iex(1)> EasySSL.parse_der(<<...>>)
%{
  extensions: %{
    authorityInfoAccess: "CA Issuers - URI:http://certificates.godaddy.com/repository/gd_intermediate.crt\nOCSP - URI:http://ocsp.godaddy.com/\n",
    authorityKeyIdentifier: "keyid:FD:AC:61:32:93:6C:45:D6:E2:EE:85:5F:9A:BA:E7:76:99:68:CC:E7\n",
    basicConstraints: "CA:FALSE",
    certificatePolicies: "Policy: 2.16.840.1.114413.1.7.23.1\n  CPS: http://certificates.godaddy.com/repository/",
    crlDistributionPoints: "Full Name:\n URI:http://crl.godaddy.com/gds1-90.crl",
    extendedKeyUsage: "TLS Web server authentication, TLS Web client authentication",
    keyUsage: "Digital Signature, Key Encipherment",
    subjectAltName: "DNS:acaline.com, DNS:www.acaline.com",
    subjectKeyIdentifier: "E6:61:14:4E:5A:4B:51:0C:4E:6C:5E:3C:79:61:65:D4:BD:64:94:BE"
  },
  fingerprint: "FA:BE:B5:9B:ED:C2:2B:42:7E:B1:45:C8:9A:8A:73:16:4A:A0:10:09",
  not_after: 1398523877,
  not_before: 1366987877,
  serial_number: "27ACAE30B9F323",
  subject: %{
    C: nil,
    CN: "www.acaline.com",
    L: nil,
    O: nil,
    OU: "Domain Control Validated",
    ST: nil,
    aggregated: "/CN=www.acaline.com/OU=Domain Control Validated"
  }
}
Link to this function parse_pem(cert_charlist) View Source

Takes in a string (or charlist) and returns a map of the parsed certificate

## Examples

  # Pass in a binary (from Base.decode64, or some other source)
  iex(1)> EasySSL.parse_pem("-----BEGIN CERTIFICATE-----\nMII...")
  %{
    extensions: %{
      authorityInfoAccess: "CA Issuers - URI:http://certificates.godaddy.com/repository/gd_intermediate.crt\nOCSP - URI:http://ocsp.godaddy.com/\n",
      authorityKeyIdentifier: "keyid:FD:AC:61:32:93:6C:45:D6:E2:EE:85:5F:9A:BA:E7:76:99:68:CC:E7\n",
      basicConstraints: "CA:FALSE",
      certificatePolicies: "Policy: 2.16.840.1.114413.1.7.23.1\n  CPS: http://certificates.godaddy.com/repository/",
      crlDistributionPoints: "Full Name:\n URI:http://crl.godaddy.com/gds1-90.crl",
      extendedKeyUsage: "TLS Web server authentication, TLS Web client authentication",
      keyUsage: "Digital Signature, Key Encipherment",
      subjectAltName: "DNS:acaline.com, DNS:www.acaline.com",
      subjectKeyIdentifier: "E6:61:14:4E:5A:4B:51:0C:4E:6C:5E:3C:79:61:65:D4:BD:64:94:BE"
    },
    fingerprint: "FA:BE:B5:9B:ED:C2:2B:42:7E:B1:45:C8:9A:8A:73:16:4A:A0:10:09",
    not_after: 1398523877,
    not_before: 1366987877,
    serial_number: "27ACAE30B9F323",
    subject: %{
      C: nil,
      CN: "www.acaline.com",
      L: nil,
      O: nil,
      OU: "Domain Control Validated",
      ST: nil,
      aggregated: "/CN=www.acaline.com/OU=Domain Control Validated"
    }
  }
Link to this function parse_pem(cert_pem, opts \\ [all_domains: false, return_base64: false]) View Source