verificationsymmetric

package
v0.0.0-...-de2cd80 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HMACSHA256 signatureProtocol = iota
	RSAPKCS1v15SHA256
	ECDSA
)
View Source
const DefaultKeysDir = "integrity-keys"
View Source
const ImplicitMessageIntegrityKey = "IMPLICIT_MESSAGE_INTEGRITY_KEY"
View Source
const ImplicitMessageIntegrityPrivateKey = "IMPLICIT_MESSAGE_INTEGRITY_PRIVATE_KEY"
View Source
const ImplicitMessageIntegrityPublicKey = "IMPLICIT_MESSAGE_INTEGRITY_PUBLIC_KEY"

Variables

This section is empty.

Functions

func FetchKeyBlock

func FetchKeyBlock(fileName string) (*pem.Block, error)

Retrieve a pem encoded file.

func FetchPrivateKey

func FetchPrivateKey(keyID KeyID) (*rsa.PrivateKey, error)

Retrieve a pem encode private key from a file.

func FetchPrivateKeyECDSA

func FetchPrivateKeyECDSA(keyID KeyID) (*ecdsa.PrivateKey, error)

Retrieve a pem encode private key from a file.

func FetchPublicKey

func FetchPublicKey(keyID KeyID) (*rsa.PublicKey, error)

Retrieve a pem encode public key from a file.

func FetchPublicKeyECDSA

func FetchPublicKeyECDSA(keyID KeyID) (*ecdsa.PublicKey, error)

Retrieve a pem encode public key from a file.

func SignECDSA

func SignECDSA(message VerifiableMessage, keyID KeyID, rand io.Reader) error

SignProto signs a proto that has a proto field Signature.

func SignPKCS1v15

func SignPKCS1v15(message VerifiableMessage, keyID KeyID) error

SignProto signs a proto that has a proto field Signature.

func SignProto

func SignProto(message VerifiableMessage, key []byte) error

SignProto signs a proto that has a proto field Signature.

func ValidateECDSA

func ValidateECDSA(message VerifiableMessage, keyID KeyID) (bool, error)

func ValidateHMAC

func ValidateHMAC(message VerifiableMessage, key []byte) (bool, error)

Check the signature embedded in the protobuf message is correct for the message by recalculating it using the secret key.

func ValidatePKCS1v15

func ValidatePKCS1v15(message VerifiableMessage, keyID KeyID) (bool, error)

Types

type KeyID

type KeyID string

type VerifiableMessage

type VerifiableMessage interface {
	proto.Message
	GetSignature() []byte
}

VerifiableMessage a proto message that has a Signature field. Using the extension interface pattern so that I can read the Signature.

Jump to

Keyboard shortcuts

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