ssl

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package ssl contains operations related to SSL certificates.

Index

Constants

View Source
const SystemCertPath = "/etc/ssl/certs"

Variables

This section is empty.

Functions

func CanonicalName

func CanonicalName(name []byte) ([]byte, error)

CanonicalName accepts a DER encoded subject name and returns a "Canonical Encoding" matching that returned by the x509_name_canon function in openssl. All string values are transformed with CanonicalString and UTF8 encoded and the leading SEQ header is removed.

see https://stackoverflow.com/questions/34095440/hash-algorithm-for-certificate-crl-directory.

func CanonicalString

func CanonicalString(s string) string

CanonicalString transforms the given string. All leading and trailing whitespace is trimmed where whitespace is defined as a space, formfeed, tab, newline, carriage return, or vertical tab character. Any remaining sequence of one or more consecutive whitespace characters in replaced with a single ' '.

This is a reimplementation of the asn1_string_canon in openssl

func CertHash

func CertHash(certPath string) (string, error)

CertHash compute cert hash from cert path

func CertRawHash

func CertRawHash(raw []byte) (string, error)

CertRawHash compute cert hash from raw content

func ParseCert

func ParseCert(raw []byte) (*x509.Certificate, error)

ParseCert parse cert from raw content

func SubjectNameHash

func SubjectNameHash(cert *x509.Certificate) (uint32, error)

SubjectNameHash is a reimplementation of the X509_subject_name_hash in openssl. It computes the SHA-1 of the canonical encoding of the certificate's subject name and returns the 32-bit integer represented by the first four bytes of the hash using little-endian byte order.

The output should be the same as the result of the following command openssl x509 -hash -fingerprint -noout -in <file>

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL