package crypto

import "github.com/aws/aws-sdk-go-v2/service/s3/internal/v4a/internal/crypto"

Index

Functions

func ConstantTimeByteCompare

func ConstantTimeByteCompare(x, y []byte) (int, error)

ConstantTimeByteCompare is a constant-time byte comparison of x and y. This function performs an absolute comparison if the two byte slices assuming they represent a big-endian number.

	 error if len(x) != len(y)
  -1 if x <  y
   0 if x == y
  +1 if x >  y

func ECDSAKey

func ECDSAKey(curve elliptic.Curve, d []byte) *ecdsa.PrivateKey

ECDSAKey takes the given elliptic curve, and private key (d) byte slice and returns the private ECDSA key.

func ECDSAKeyFromPoint

func ECDSAKeyFromPoint(curve elliptic.Curve, d *big.Int) *ecdsa.PrivateKey

ECDSAKeyFromPoint takes the given elliptic curve and point and returns the private and public keypair

func ECDSAPublicKey

func ECDSAPublicKey(curve elliptic.Curve, x, y []byte) (*ecdsa.PublicKey, error)

ECDSAPublicKey takes the provide curve and (x, y) coordinates and returns *ecdsa.PublicKey. Returns an error if the given points are not on the curve.

func HMACKeyDerivation

func HMACKeyDerivation(hash func() hash.Hash, bitLen int, key []byte, label, context []byte) ([]byte, error)

HMACKeyDerivation provides an implementation of a NIST-800-108 of a KDF (Key Derivation Function) in Counter Mode. For the purposes of this implantation HMAC is used as the PRF (Pseudorandom function), where the value of `r` is defined as a 4 byte counter.

func VerifySignature

func VerifySignature(key *ecdsa.PublicKey, hash []byte, signature []byte) (bool, error)

VerifySignature takes the provided public key, hash, and asn1 encoded signature and returns whether the given signature is valid.

Source Files

compare.go ecc.go

Version
v1.26.2
Published
Mar 24, 2022
Platform
js/wasm
Imports
10 packages
Last checked
3 minutes ago

Tools for package owners.