tools

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GPG_MD5       = 1
	GPG_SHA1      = 2
	GPG_RIPEMD160 = 3
	GPG_SHA256    = 8
	GPG_SHA384    = 9
	GPG_SHA512    = 10
	GPG_SHA224    = 11
)
View Source
const DefaultTag = "00000000+0000+0000+0000+000000000000"

DefaultTag represents a default tag to be used in logs

Variables

This section is empty.

Functions

func ByteFingerPrint2FP16

func ByteFingerPrint2FP16(raw []byte) string

func CRC24

func CRC24(d []byte) uint32

CRC24 calculates the OpenPGP checksum as specified in RFC 4880, section 6.1

func CanDecodeBase64

func CanDecodeBase64(s string) bool

CanDecodeBase64 returns true if s is a valid base64

func CompareFingerPrint

func CompareFingerPrint(fpA, fpB string) bool

func ContextWithValues

func ContextWithValues(parent context.Context, values map[string]interface{}) context.Context

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies file src to dst

func CopyFiles

func CopyFiles(src, dst string) error

func CreateEntityForSubKey

func CreateEntityForSubKey(masterFingerPrint string, pubKey *packet.PublicKey, privKey *packet.PrivateKey) *openpgp.Entity

func CreateEntityFromKeys

func CreateEntityFromKeys(name, comment, email string, lifeTimeInSecs uint32, pubKey *packet.PublicKey, privKey *packet.PrivateKey) *openpgp.Entity

func ExtractIdentifierFields

func ExtractIdentifierFields(identifier string) (name, email, comment string)

func FPto16 added in v1.4.0

func FPto16(fingerprint string) string

FPto16 returns a 16 byte fingerprint for the specified fingerprint if len(fingerprint) < 16 it returns the same string in upper case

func FolderExists

func FolderExists(folder string) bool

func GPG2Quanto

func GPG2Quanto(signature, fingerPrint, hash string) string

func GeneratePassword

func GeneratePassword() string

func GenerateTag

func GenerateTag() string

GenerateTag generates a new UUID tag with - replaced by +

func GetFingerPrintFromKey

func GetFingerPrintFromKey(armored string) (string, error)

func GetFingerPrintsFromEncryptedMessage

func GetFingerPrintsFromEncryptedMessage(armored string) ([]string, error)

func GetFingerPrintsFromEncryptedMessageRaw

func GetFingerPrintsFromEncryptedMessageRaw(rawB64Data string) ([]string, error)

func GetFingerPrintsFromKey

func GetFingerPrintsFromKey(armored string) ([]string, error)

func GetRequestIDFromContext

func GetRequestIDFromContext(ctx context.Context) string

func IdentityMapToArray

func IdentityMapToArray(m map[string]*openpgp.Identity) []*openpgp.Identity

func IsASCIIArmored

func IsASCIIArmored(data string) bool

IsASCIIArmored returns true if data is ascii armored

func IssuerKeyIdToFP16

func IssuerKeyIdToFP16(issuerKeyId uint64) string

func Quanto2GPG

func Quanto2GPG(signature string) string

func ReadKey

func ReadKey(armored string) (openpgp.EntityList, error)

func ReadKeyToEntity

func ReadKeyToEntity(asciiArmored string) (*openpgp.Entity, error)

func SignatureFix

func SignatureFix(sig string) string

SignatureFix recalculates the CRC

func SimpleIdentitiesToString

func SimpleIdentitiesToString(ids []*openpgp.Identity) string

func StringIndexOf

func StringIndexOf(v string, a []string) int

func TruncateFieldForDisplay

func TruncateFieldForDisplay(fieldData string) string

TruncateFieldForDisplay truncates the field to display in log files

Types

type ContextField

type ContextField string
const (
	CtxRequestID       ContextField = "requestID"
	CtxDatabaseHandler ContextField = "dbHandler"
)

Jump to

Keyboard shortcuts

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