sec

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 22 Imported by: 8

Documentation

Overview

Decoder for PKCS#5 encrypted PKCS#8 private keys.

Index

Constants

This section is empty.

Variables

View Source
var KeyPassword = []byte{}

For testing, a key can be set here. If this is empty, the key will be queried via prompt.

Functions

func EncryptAES

func EncryptAES(plain []byte, secret []byte) ([]byte, error)

func RawKeyHash

func RawKeyHash(pubKeyBytes []byte) []byte

func VerifySigs

func VerifySigs(key PubSignKey, sigs []Sig, hash []byte) (int, error)

Types

type PrivEncKey added in v0.0.2

type PrivEncKey struct {
	Rsa *rsa.PrivateKey
}

XXX: Only RSA supported for now.

func ParsePrivEncKey added in v0.0.2

func ParsePrivEncKey(keyBytes []byte) (PrivEncKey, error)

func ReadPrivEncKey added in v0.0.2

func ReadPrivEncKey(filename string) (PrivEncKey, error)

ReadPubEncKey reads a private encryption key from a file.

func ReadPrivEncKeys added in v0.0.2

func ReadPrivEncKeys(filenames []string) ([]PrivEncKey, error)

ReadPubSignKeys reads a set of private encryption keys from several files.

func (*PrivEncKey) Decrypt added in v0.0.2

func (k *PrivEncKey) Decrypt(ciph []byte) ([]byte, error)

type PrivSignKey added in v0.0.2

type PrivSignKey struct {
	// Only one of these members is non-nil.
	Rsa *rsa.PrivateKey
	Ec  *ecdsa.PrivateKey
}

func ParsePrivSignKey added in v0.0.2

func ParsePrivSignKey(keyBytes []byte) (PrivSignKey, error)

func ReadPrivSignKey added in v0.0.2

func ReadPrivSignKey(filename string) (PrivSignKey, error)

ReadPrivSignKey reads a private signing key from a file.

func ReadPrivSignKeys added in v0.0.2

func ReadPrivSignKeys(filenames []string) ([]PrivSignKey, error)

ReadPubSignKeys reads a set of private signing keys from several files.

func (*PrivSignKey) AssertValid added in v0.0.2

func (key *PrivSignKey) AssertValid()

func (*PrivSignKey) PubBytes added in v0.0.2

func (key *PrivSignKey) PubBytes() ([]byte, error)

func (*PrivSignKey) PubKey added in v0.0.2

func (key *PrivSignKey) PubKey() PubSignKey

func (*PrivSignKey) SigLen added in v0.0.2

func (key *PrivSignKey) SigLen() uint16

type PubEncKey added in v0.0.2

type PubEncKey struct {
	Rsa *rsa.PublicKey
	Aes cipher.Block
}

func ParsePubEncKey added in v0.0.2

func ParsePubEncKey(keyBytes []byte) (PubEncKey, error)

func ReadPubEncKey added in v0.0.2

func ReadPubEncKey(filename string) (PubEncKey, error)

ReadPubEncKey reads a public encryption key from a file.

func ReadPubEncKeys added in v0.0.2

func ReadPubEncKeys(filenames []string) ([]PubEncKey, error)

ReadPubSignKeys reads a set of public encryption keys from several files.

func (*PubEncKey) AssertValid added in v0.0.2

func (key *PubEncKey) AssertValid()

func (*PubEncKey) Encrypt added in v0.0.2

func (k *PubEncKey) Encrypt(plain []byte) ([]byte, error)

type PubSignKey

type PubSignKey struct {
	Rsa *rsa.PublicKey
	Ec  *ecdsa.PublicKey
}

func ParsePubSignKey added in v0.0.2

func ParsePubSignKey(keyBytes []byte) (PubSignKey, error)

func ReadPubSignKey added in v0.0.2

func ReadPubSignKey(filename string) (PubSignKey, error)

ReadPubSignKey reads a public signing key from a file.

func ReadPubSignKeys added in v0.0.2

func ReadPubSignKeys(filenames []string) ([]PubSignKey, error)

ReadPubSignKeys reads a set of public signing keys from several files.

func (*PubSignKey) AssertValid

func (key *PubSignKey) AssertValid()

func (*PubSignKey) Bytes

func (key *PubSignKey) Bytes() ([]byte, error)

type Sig

type Sig struct {
	KeyHash []byte
	Data    []byte
}

Jump to

Keyboard shortcuts

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