common

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ECDSAPublicKeyFromJwk added in v0.9.0

func ECDSAPublicKeyFromJwk(jwk map[string]any) (*ecdsa.PublicKey, error)

func EllipticCurveSign

func EllipticCurveSign(rand io.Reader, pk ecdsa.PrivateKey, digest []byte, keySize int) ([]byte, error)

func ExtractRSFromSignature

func ExtractRSFromSignature(signature []byte, keySize int) (*big.Int, *big.Int, error)

func JwkFromECDSAPrivateKey

func JwkFromECDSAPrivateKey(privateKey *ecdsa.PrivateKey) map[string]any

func JwkFromECDSAPublicKey

func JwkFromECDSAPublicKey(publicKey *ecdsa.PublicKey) map[string]any

func JwkFromRSAPrivateKey

func JwkFromRSAPrivateKey(privateKey *rsa.PrivateKey) map[string]any

func JwkFromRSAPublicKey

func JwkFromRSAPublicKey(publicKey *rsa.PublicKey) map[string]any

func NewECDSAPublicKeyFromJson

func NewECDSAPublicKeyFromJson(publicKeyJson []byte, curve elliptic.Curve) (*ecdsa.PublicKey, error)

func NewRSAPublicKeyFromJson

func NewRSAPublicKeyFromJson(publicKeyJson []byte) (*rsa.PublicKey, error)

func RSAPublicKeyFromJwk added in v0.9.0

func RSAPublicKeyFromJwk(jwk map[string]any) (*rsa.PublicKey, error)

func RsaPSSSign

func RsaPSSSign(rand io.Reader, pk rsa.PrivateKey, digest []byte, hash crypto.Hash, saltLength int) ([]byte, error)

func RsaPkcs1Sign

func RsaPkcs1Sign(rand io.Reader, pk rsa.PrivateKey, digest []byte, hash crypto.Hash) ([]byte, error)

Types

type ECDSAPublicKey

type ECDSAPublicKey struct {
	Kty string `json:"kty"`
	Crv string `json:"crv"`
	X   string `json:"x"`
	Y   string `json:"y"`
}

func (*ECDSAPublicKey) Equal

func (pubKey *ECDSAPublicKey) Equal(x ECDSAPublicKey) bool

type RSAPublicKey

type RSAPublicKey struct {
	N string `json:"n"`
	E string `json:"e"`
}

func (*RSAPublicKey) Equal

func (pubKey *RSAPublicKey) Equal(x RSAPublicKey) bool

type SecretKey added in v0.8.0

type SecretKey []byte

func (*SecretKey) Equal added in v0.8.0

func (s *SecretKey) Equal(x crypto.PublicKey) bool

Jump to

Keyboard shortcuts

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