security

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const PEM_HEADER_KEY = "SignerKey"
View Source
const PEM_HEADER_NAME = "Name"
View Source
const PEM_HEADER_SIGTYPE = "SigType"
View Source
const PEM_HEADER_VALIDITY = "Validity"
View Source
const PEM_TYPE_CERT = "NDN CERT"
View Source
const PEM_TYPE_SECRET = "NDN KEY"

Variables

This section is empty.

Functions

func CertIsExpired added in v1.4.3

func CertIsExpired(cert ndn.Data) bool

func DecodeFile added in v1.4.3

func DecodeFile(content []byte) (signers []ndn.Signer, certs [][]byte, err error)

DecodeFile decodes all signers and certs from the given content. The input can either be TLV or PEM encoded. If PEM encoded, the input may have more than one signers and/or certs. May return empty slices for signers and certs if no valid entries.

func GetIdentityFromCertName added in v1.5.0

func GetIdentityFromCertName(name enc.Name) (enc.Name, error)

GetIdentityFromCertName extracts the identity name from a certificate name.

func GetIdentityFromKeyName added in v1.4.3

func GetIdentityFromKeyName(name enc.Name) (enc.Name, error)

GetIdentityFromKeyName extracts the identity name from a key name.

func GetKeyNameFromCertName added in v1.4.3

func GetKeyNameFromCertName(name enc.Name) (enc.Name, error)

GetKeyNameFromCertName extracts the key name from a certificate name.

func MakeCertName added in v1.4.3

func MakeCertName(keyName enc.Name, issuerId enc.Component, version uint64) (enc.Name, error)

MakeCertName generates a new certificate name for a given key name.

func MakeKeyName added in v1.4.3

func MakeKeyName(name enc.Name) enc.Name

MakeKeyName generates a new key name for a given identity.

func PemDecode added in v1.4.3

func PemDecode(str []byte) [][]byte

PemDecode converts a text representation of an NDN data.

func PemEncode added in v1.4.3

func PemEncode(raw []byte) ([]byte, error)

PemEncode converts an NDN data to a text representation following RFC 7468.

func SelfSign added in v1.5.0

func SelfSign(args SignCertArgs) (enc.Wire, error)

SelfSign generates a self-signed certificate.

func SignCert added in v1.4.3

func SignCert(args SignCertArgs) (enc.Wire, error)

SignCert signs a new NDN certificate with the given signer. Data must have either a Key or Secret in the Content.

Types

type SignCertArgs added in v1.4.3

type SignCertArgs struct {
	// Signer is the private key used to sign the certificate.
	Signer ndn.Signer
	// Data is the CSR or Key to be signed.
	Data ndn.Data
	// IssuerId is the issuer ID to be included in the certificate name.
	IssuerId enc.Component
	// NotBefore is the start of the certificate validity period.
	NotBefore time.Time
	// NotAfter is the end of the certificate validity period.
	NotAfter time.Time
	// Description is extra information to be included in the certificate.
	Description map[string]string
}

SignCertArgs are the arguments to SignCert.

type TrustConfig added in v1.4.3

type TrustConfig struct {
	// contains filtered or unexported fields
}

TrustConfig is the configuration of the trust module.

func NewTrustConfig added in v1.4.3

func NewTrustConfig(keyChain ndn.KeyChain, schema ndn.TrustSchema, roots []enc.Name) (*TrustConfig, error)

NewTrustConfig creates a new TrustConfig. ALl roots must be full names and already present in the keychain.

func (*TrustConfig) String added in v1.4.3

func (tc *TrustConfig) String() string

func (*TrustConfig) Suggest added in v1.4.3

func (tc *TrustConfig) Suggest(name enc.Name) ndn.Signer

Suggest suggests a signer for a given name.

func (*TrustConfig) Validate added in v1.4.3

func (tc *TrustConfig) Validate(args TrustConfigValidateArgs)

Validate validates a Data packet using a fetch API.

type TrustConfigValidateArgs added in v1.4.3

type TrustConfigValidateArgs struct {
	// Data is the packet to validate.
	Data ndn.Data
	// DataSigCov is the signature covered data wire.
	DataSigCov enc.Wire

	// Fetch is the fetch function to use for fetching certificates.
	Fetch func(enc.Name, *ndn.InterestConfig, ndn.ExpressCallbackFunc)
	// Callback is the callback to call when validation is done.
	Callback func(bool, error)
	// OverrideName is an override for the data name (advanced usage).
	OverrideName enc.Name
	// contains filtered or unexported fields
}

TrustConfigValidateArgs are the arguments for the TrustConfig Validate function.

Directories

Path Synopsis
tlv
Code generated by ndn tlv codegen DO NOT EDIT.
Code generated by ndn tlv codegen DO NOT EDIT.
Code generated by ndn tlv codegen DO NOT EDIT.
Code generated by ndn tlv codegen DO NOT EDIT.

Jump to

Keyboard shortcuts

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