cahash

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

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.

For more information 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 GenerateHash

func GenerateHash(certRaw []byte) (string, error)

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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