crypto

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: Apache-2.0 Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptKeyBytes

func DecryptKeyBytes(pemKeyEncrypted []byte, pw []byte) ([]byte, error)

func EnsureKey

func EnsureKey(keyFile string) (crypto.PublicKey, crypto.PrivateKey, bool, error)

func GetExtensionValue

func GetExtensionValue(cert *x509.Certificate, oid asn1.ObjectIdentifier) (string, error)

func GetPEMBlock

func GetPEMBlock(pemKey []byte) (*pem.Block, error)

func HashPublicKey

func HashPublicKey(key crypto.PublicKey) ([]byte, error)

func IsEncryptedPEMKey

func IsEncryptedPEMKey(pemKey []byte) (bool, error)

func LoadKey

func LoadKey(keyFile string) (crypto.PrivateKey, error)

func MakeCSR

func MakeCSR(privateKey crypto.Signer, subjectName string) ([]byte, error)

func NewKeyPair

func NewKeyPair() (crypto.PublicKey, crypto.PrivateKey, error)

func NewKeyPairWithHash

func NewKeyPairWithHash() (crypto.PublicKey, crypto.PrivateKey, []byte, error)

func PEMEncodeKey

func PEMEncodeKey(key crypto.PrivateKey) ([]byte, error)

func ParseCSR

func ParseCSR(csrPEM []byte) (*x509.CertificateRequest, error)

func ParseKeyPEM

func ParseKeyPEM(pemKey []byte) (crypto.PrivateKey, error)

func WriteKey

func WriteKey(keyPath string, key crypto.PrivateKey) error

func WritePasswordEncryptedKey

func WritePasswordEncryptedKey(keyPath string, key crypto.PrivateKey, password []byte) error

this copies functionality from sigstore's cosign to encrypt the private key using functionality from secure systems lab, which relies on golang crypto's secretbox and scrypt. see: https://github.com/sigstore/cosign/blob/77f71e0d7470e31ed4ed5653fe5a7c8e3b283606/pkg/cosign/keys.go#L158 https://github.com/secure-systems-lab/go-securesystemslib/blob/7dd9eabdaf9ea98ba33653cdfbdec7057bd662fd/encrypted/encrypted.go#L158

Types

This section is empty.

Jump to

Keyboard shortcuts

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