gpg

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert509CertificateToPGPPublicKey

func Convert509CertificateToPGPPublicKey(c *x509.Certificate) *packet.PublicKey

Convert509CertificateToPGPPublicKey returns PGP public key from x509.Certificate

func ConvertLocalSignerToPgpPrivateKey

func ConvertLocalSignerToPgpPrivateKey(creationTime time.Time, signer crypto.Signer) *packet.PrivateKey

ConvertLocalSignerToPgpPrivateKey creates a sign-only PrivateKey from a crypto.Signer that implements RSA or ECDSA.

func ConvertPemToPgpPrivateKey

func ConvertPemToPgpPrivateKey(creationTime time.Time, privateKeyPem []byte) (*packet.PrivateKey, error)

ConvertPemToPgpPrivateKey parses a PEM encoded private key.

func ConvertPublicKeyToPGP

func ConvertPublicKeyToPGP(creationTime time.Time, pub crypto.PublicKey) *packet.PublicKey

ConvertPublicKeyToPGP returns PGP public key

func ConvertToPacketPrivateKey

func ConvertToPacketPrivateKey(creationTime time.Time, s crypto.PrivateKey) (*packet.PrivateKey, error)

ConvertToPacketPrivateKey converts a private key interface to PKCS11PrivateKey type

func ConvertTopX509CertificateToPGPPublicKey

func ConvertTopX509CertificateToPGPPublicKey(certificateChainPem string) (*packet.PublicKey, error)

ConvertTopX509CertificateToPGPPublicKey converts certificate in PEM fromat to PGP public key

func CreateOpenPGPEntity

func CreateOpenPGPEntity(pubKey *packet.PublicKey, privKey *packet.PrivateKey, uid *packet.UserId, ops OpenPGPEntityOp) (*openpgp.Entity, error)

CreateOpenPGPEntity creates PGP signer from private and public keys

func DecodeArmoredPgpSignature

func DecodeArmoredPgpSignature(armored io.Reader) (*packet.Signature, error)

DecodeArmoredPgpSignature decodes PGP signature

func DecodePGPEntityFromPEM

func DecodePGPEntityFromPEM(r io.Reader) (*openpgp.Entity, error)

DecodePGPEntityFromPEM reads Entity from the given io.Reader

func EncodePGPEntityToPEM

func EncodePGPEntityToPEM(e *openpgp.Entity) ([]byte, error)

EncodePGPEntityToPEM returns PEM encoded Entity's Public Key

func GetPgpPubkeyAlgo

func GetPgpPubkeyAlgo(pubkey *packet.PublicKey) (string, error)

GetPgpPubkeyAlgo returns algorithm in RSA2048 or ECDSA format

func KeyRing

func KeyRing(data []byte) (openpgp.EntityList, error)

KeyRing reads a openpgp.KeyRing from the given io.Reader which may then be used to validate GPG keys in RPM packages.

func KeyRingFromFile

func KeyRingFromFile(path string) (openpgp.EntityList, error)

KeyRingFromFile reads a openpgp.KeyRing from the given file path which may then be used to validate GPG keys in RPM packages.

func KeyRingFromFiles

func KeyRingFromFiles(files []string) (openpgp.EntityList, error)

KeyRingFromFiles reads a openpgp.KeyRing from the given file paths which may then be used to validate GPG keys in RPM packages.

This function might typically be used to read all keys in /etc/pki/rpm-gpg.

func OpenpgpDetachSign

func OpenpgpDetachSign(message io.Reader, w io.Writer, signer *openpgp.Entity, sigType OpenpgpSignatureType, config *packet.Config) (err error)

OpenpgpDetachSign creates detached signature on message

func VerifySignaturePGP

func VerifySignaturePGP(signed hash.Hash, pemSignature string, pubkey *packet.PublicKey) error

VerifySignaturePGP verifies the signatures

Types

type OpenPGPEntityOp

type OpenPGPEntityOp int

OpenPGPEntityOp specifies operation to perform on Entity

const (
	// OpenPGPEntityOpNone specifies not to perform any operation
	OpenPGPEntityOpNone OpenPGPEntityOp = 0

	// OpenPGPEntitySignSelf specifies to sign self
	OpenPGPEntitySignSelf OpenPGPEntityOp = 1 << iota // 1 << 0 which is 00000001
	// OpenPGPEntitySignSubkeys specifies to sign subkeys
	OpenPGPEntitySignSubkeys
	// OpenPGPEntitySignIdentity specifies to sign Identity
	OpenPGPEntitySignIdentity

	// OpenPGPEntitySignAll specifies to sign Identity, subkeys, self
	OpenPGPEntitySignAll = OpenPGPEntitySignSubkeys | OpenPGPEntitySignSelf // | OpenPGPEntitySignIdentity
)

type OpenpgpSignatureType

type OpenpgpSignatureType packet.SignatureType

OpenpgpSignatureType represents the different semantic meanings of an OpenPGP signature. See RFC 4880, section 5.2.1.

const (
	// OpenpgpSigTypeBinary specifies Binary signature format
	OpenpgpSigTypeBinary OpenpgpSignatureType = 0
	// OpenpgpSigTypeText specifies Text signature format
	OpenpgpSigTypeText = 1
)

Jump to

Keyboard shortcuts

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