utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package utils contains helper functions related to the sop implementation of gopenpgp.

Index

Constants

View Source
const ArmorPrefix = ""
View Source
const DefaultProfileName string = "default"

Variables

View Source
var EncryptionProfiles = createEncryptionProfiles()
View Source
var KeyGenerationProfiles = createKeyGenerationProfiles()

Functions

func CollectFilesFromCliSlice added in v1.0.0

func CollectFilesFromCliSlice(data []string) []string

func CollectKeys

func CollectKeys(keyFilenames ...string) (*crypto.KeyRing, error)

CollectKeys forms a crypto.KeyRing with all the keys provided in the input files. It returns the keyring and an error.

func CollectKeysPassword added in v1.0.0

func CollectKeysPassword(password []byte, keyFilenames ...string) (*crypto.KeyRing, bool, error)

CollectKeysPassword forms a crypto.KeyRing with all the keys provided in the input files and tries to unlock them with password if locked. It returns the keyring, a bool indicating an unlock issue, and an error.

func Linebreak

func Linebreak()

Linebreak prints "\n" to os.Stdout.

func OpenOutFile added in v1.1.0

func OpenOutFile(filename string) (*os.File, error)

func ParseDates

func ParseDates(notBefore, notAfter string) (nb, na time.Time, err error)

ParseDates reads --not-before and --not-after flags, and parses them according to the layout.

func ParseUserID

func ParseUserID(id string) (x, y, z string, err error)

ParseUserID takes a string of the form "x (y) <z>" and outputs x, y, z and an error. Note that x, y may contain whitespaces.

func ReadFileOrEnv

func ReadFileOrEnv(filename string) ([]byte, error)

func ReadSanitizedPassword added in v1.0.0

func ReadSanitizedPassword(filename string) ([]byte, error)

func VerificationString

func VerificationString(timestamp time.Time, fgp, primFgp []byte, mode string) string

VerificationString gives the line containing the result of a verification.

Types

type SopProfile added in v1.0.0

type SopProfile struct {
	Names         []string
	Description   string
	PgpProfile    *profile.Custom
	SecurityLevel int8 // Only applies to key generation.
}

func SelectEncryptionProfile added in v1.0.0

func SelectEncryptionProfile(name string) (selectedProfile *SopProfile)

func SelectKeyGenerationProfile added in v1.0.0

func SelectKeyGenerationProfile(name string) (selectedProfile *SopProfile)

Jump to

Keyboard shortcuts

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