ssl

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Certificates = map[string]*Certificate{}

Certificates loaded

Functions

func CertificateSerialNumber

func CertificateSerialNumber(data string) (string, error)

CertificateSerialNumber get the SN of the certificate

func IsCertificateExpired

func IsCertificateExpired(data string) (bool, error)

IsCertificateExpired check if the certificate was expired

func IsCertificateValid

func IsCertificateValid(data string, now time.Time) (bool, error)

IsCertificateValid check if the certificate is expired at time

func ProcessSign

func ProcessSign(process *process.Process) interface{}

ProcessSign computes a signature for the specified data by generating a cryptographic digital signature

func ProcessVerify

func ProcessVerify(process *process.Process) interface{}

ProcessVerify verifies that the signature is correct for the specified data

func Sign

func Sign(data []byte, cert *Certificate, algorithm string) ([]byte, error)

Sign computes a signature for the specified data by generating a cryptographic digital signature using the private key associated with private_key.

func SignBase64

func SignBase64(data []byte, cert *Certificate, algorithm string) (string, error)

SignBase64 Generate signature

func SignHexBase64

func SignHexBase64(data string, cert *Certificate, algorithm string) (string, error)

SignHexBase64 Generate signature

func SignStrBase64

func SignStrBase64(data string, cert *Certificate, algorithm string) (string, error)

SignStrBase64 Generate signature

func Verify

func Verify(data []byte, signature []byte, cert *Certificate, algorithm string) (bool, error)

Verify verifies that the signature is correct for the specified data using the public key associated with public_key. This must be the public key corresponding to the private key used for signing.

func VerifyBase64

func VerifyBase64(data []byte, signature string, cert *Certificate, algorithm string) (bool, error)

VerifyBase64 Verify signature

func VerifyHexBase64

func VerifyHexBase64(data string, signature string, cert *Certificate, algorithm string) (bool, error)

VerifyHexBase64 Verify signature

func VerifyStrBase64

func VerifyStrBase64(data string, signature string, cert *Certificate, algorithm string) (bool, error)

VerifyStrBase64 Verify signature

Types

type Certificate

type Certificate struct {
	Type   string
	Format string // PEM
	// contains filtered or unexported fields
}

Certificate the ssl Certificate

func Load added in v0.10.3

func Load(file string, name string) (*Certificate, error)

Load Load the certificate from the given file

func LoadCertificate

func LoadCertificate(data []byte, name string) (*Certificate, error)

LoadCertificate load the certificate from the given file

func NewCertificate

func NewCertificate(data []byte) (*Certificate, error)

NewCertificate creat a new certificate from file

Jump to

Keyboard shortcuts

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