crypto

package
v0.0.0-...-15ef477 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptRequest

func DecryptRequest(request model.WorkerRequest, rsaPrivateKey *rsa.PrivateKey) ([]byte, error)

func EncryptRequest

func EncryptRequest(content []byte, rsaPublicKey *rsa.PublicKey) (contentEncrypted []byte, encryptionType string, err error)

func FingerprintPublicKey

func FingerprintPublicKey(
	key *rsa.PublicKey,
	challengeLevel uint,
	fingerprintLengthInGroups uint,
) (string, error)

func GenerateCertificateBytes

func GenerateCertificateBytes(privateKey *rsa.PrivateKey, validFor time.Duration, hosts []string) ([]byte, error)

func GeneratePrivateKey

func GeneratePrivateKey(rsaKeySize int) (*rsa.PrivateKey, error)

func GeneratePublicKeyBytes

func GeneratePublicKeyBytes(privateKey *rsa.PrivateKey) ([]byte, error)

func MarshalPrivateKeyToPEMBytes

func MarshalPrivateKeyToPEMBytes(key *rsa.PrivateKey) []byte

func UnmarshalCertificateFromPEMBytes

func UnmarshalCertificateFromPEMBytes(bytes []byte) (*x509.Certificate, error)

func UnmarshalPrivateKeyFromPEMBytes

func UnmarshalPrivateKeyFromPEMBytes(bytes []byte) (*rsa.PrivateKey, error)

func UnmarshalPublicKey

func UnmarshalPublicKey(publicKeyBytes []byte) (*rsa.PublicKey, error)

Types

type VerifyByFingerprint

type VerifyByFingerprint struct {
	Fingerprint               string
	FingerprintChallengeLevel uint
	FingerprintLength         uint
}

func (*VerifyByFingerprint) VerifyPeerCertificate

func (v *VerifyByFingerprint) VerifyPeerCertificate(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error

VerifyPeerCertificate validates that one of the given certificates contains a public key matching the configured fingerprint.

Jump to

Keyboard shortcuts

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