Documentation ¶
Index ¶
- Constants
- func AlgorithmID(jwk *jwk.JWK) (string, error)
- func BytesToPublicKey(algorithmID string, input []byte) (jwk.JWK, error)
- func GeneratePrivateKey(algorithmID string) (jwk.JWK, error)
- func GetJWA(jwk jwk.JWK) (string, error)
- func GetPublicKey(privateKey jwk.JWK) jwk.JWK
- func PublicKeyToBytes(publicKey jwk.JWK) ([]byte, error)
- func SECP256K1BytesToPublicKey(input []byte) (jwk.JWK, error)
- func SECP256K1GeneratePrivateKey() (jwk.JWK, error)
- func SECP256K1PublicKeyToBytes(publicKey jwk.JWK) ([]byte, error)
- func SECP256K1Sign(payload []byte, privateKey jwk.JWK) ([]byte, error)
- func SECP256K1Verify(payload []byte, signature []byte, publicKey jwk.JWK) (bool, error)
- func Sign(payload []byte, privateKey jwk.JWK) ([]byte, error)
- func SupportsAlgorithmID(id string) bool
- func Verify(payload []byte, signature []byte, publicKey jwk.JWK) (bool, error)
Constants ¶
const ( SECP256K1JWA string = "ES256K" SECP256K1JWACurve string = "secp256k1" SECP256K1AlgorithmID string = SECP256K1JWACurve )
const (
KeyType = "EC"
)
Variables ¶
This section is empty.
Functions ¶
func AlgorithmID ¶
AlgorithmID returns the algorithm ID for the given jwk.JWK
func BytesToPublicKey ¶
BytesToPublicKey deserializes the given byte array into a jwk.JWK for the given cryptographic algorithm
func GeneratePrivateKey ¶
GeneratePrivateKey generates an ECDSA private key for the given algorithm
func GetPublicKey ¶
GetPublicKey builds an ECDSA public key from the given ECDSA private key
func PublicKeyToBytes ¶
PublicKeyToBytes serializes the given public key into a byte array
func SECP256K1BytesToPublicKey ¶
SECP256K1BytesToPublicKey converts a secp256k1 public key to a JWK. Supports both Compressed and Uncompressed public keys described in https://www.secg.org/sec1-v2.pdf section 2.3.3
func SECP256K1GeneratePrivateKey ¶
SECP256K1GeneratePrivateKey generates a new private key
func SECP256K1PublicKeyToBytes ¶
SECP256K1PublicKeyToBytes converts a secp256k1 public key JWK to bytes. Note: this function returns the uncompressed public key. compressed is not yet supported
func SECP256K1Sign ¶
SECP256K1Sign signs the given payload with the given private key
func SECP256K1Verify ¶
SECP256K1Verify verifies the given signature over the given payload with the given public key
func Sign ¶
Sign generates a cryptographic signature for the given payload with the given private key
Note ¶
The function will automatically detect the given ECDSA cryptographic curve from the given private key
func SupportsAlgorithmID ¶
SupportsAlgorithmID informs as to whether or not the given algorithm ID is supported by this package
Types ¶
This section is empty.