pubkey

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ECDSA with SHA-256 signature hash
	ES256 = KeyType(-7)
	// ECDSA with SHA-384 signature hash
	ES384 = KeyType(-35)
	// ECDSA with SHA-512 signature hash
	ES512 = KeyType(-36)
	// RSASSA-PSS with SHA-256 signature hash
	RS256 = KeyType(-257)
	// RSASSA-PSS with SHA-384 signature hash
	RS384 = KeyType(-258)
	// RSASSA-PSS with SHA-512 signature hash
	RS512 = KeyType(-259)
	// RSASSA-PKCS1 with SHA-256 signature hash
	PS256 = KeyType(-37)
	// RSASSA-PKCS1 with SHA-384 signature hash
	PS384 = KeyType(-38)
	// RSASSA-PKCS1 with SHA-512 signature hash
	PS512 = KeyType(-39)
)

Variables

View Source
var AllKeyTypes = []KeyType{
	ES256, ES384, ES512,
	RS256, RS256, RS256,
	PS256, PS384, PS512,
}

AllKeyTypes is a list of all supported key types.

Functions

func Decode

func Decode(publicKeyBytes []byte) (crypto.PublicKey, error)

Decode parses a DER-encoded public key, specifically for storage of registered credentials.

func Encode

func Encode(publicKey crypto.PublicKey) ([]byte, error)

Encode serializes a public key to DER format, specifically for storage of registered credentials.

func VerifySignature

func VerifySignature(publicKey crypto.PublicKey, hasher crypto.Hash, data, signature []byte) (bool, error)

VerifySignature verifies a signature against a public key.

Types

type KeyType

type KeyType int

KeyType is a type of public key and signature algorithm.

func (KeyType) CheckKey

func (k KeyType) CheckKey(key crypto.PublicKey) bool

CheckKey checks that the given public key is valid for this public key type.

func (KeyType) Hash

func (k KeyType) Hash() crypto.Hash

Hash returns the hash function used by this public key type.

Jump to

Keyboard shortcuts

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