keypem

package
v0.17.4 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const PrivPemType = "LIBP2P PRIVATE KEY"

PrivPemType is the expected header type on private keys.

View Source
const PubPemType = "LIBP2P PUBLIC KEY"

PubPemType is the expected header type on public keys.

Variables

View Source
var ErrUnexpectedPemType = errors.New("keypem: unexpected pem type")

ErrUnexpectedPemType is returned for an unexpected pem type.

Functions

func MarshalPrivKeyPem

func MarshalPrivKeyPem(key crypto.PrivKey) ([]byte, error)

MarshalPrivKeyPem marshals a private key to pem.

func MarshalPubKeyPem

func MarshalPubKeyPem(key crypto.PubKey) ([]byte, error)

MarshalPubKeyPem marshals a public key to pem.

func ParseKeyPem added in v0.12.4

func ParseKeyPem(pemDat []byte) (crypto.PrivKey, crypto.PubKey, error)

ParseKeyPem parses a private or public key in pem format. Derives the public key from the private key. Returns nil for the private key if not set. Returns nil, nil, nil if nothing found in the pem.

func ParsePrivKeyPem

func ParsePrivKeyPem(pemDat []byte) (crypto.PrivKey, error)

ParsePrivKeyPem parses a private key in pem format. If none is found returns nil

func ParsePubKeyPem

func ParsePubKeyPem(pemDat []byte) (crypto.PubKey, error)

ParsePubKeyPem parses a public key in pem format. Accepts either a private key or a public key. If none is found returns nil

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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