Documentation ¶
Overview ¶
Package eddsa implements the EdDSA signature schemes as per RFC 8032 https://tools.ietf.org/html/rfc8032. Note: Currently only Ed25519 is supported
Index ¶
- Constants
- func AlgorithmID(jwk *jwk.JWK) (string, error)
- func BytesToPublicKey(algorithmID string, input []byte) (jwk.JWK, error)
- func ED25519BytesToPublicKey(input []byte) (jwk.JWK, error)
- func ED25519GeneratePrivateKey() (jwk.JWK, error)
- func ED25519PublicKeyToBytes(publicKey jwk.JWK) ([]byte, error)
- func ED25519Sign(payload []byte, privateKey jwk.JWK) ([]byte, error)
- func ED25519Verify(payload []byte, signature []byte, publicKey jwk.JWK) (bool, 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 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 ( ED25519JWACurve string = "Ed25519" ED25519AlgorithmID string = ED25519JWACurve )
const ( JWA string = "EdDSA" KeyType string = "OKP" )
Variables ¶
This section is empty.
Functions ¶
func AlgorithmID ¶ added in v0.11.0
AlgorithmID returns the algorithm ID for the given jwk.JWK
func BytesToPublicKey ¶ added in v0.2.0
BytesToPublicKey deserializes the given byte array into a jwk.JWK for the given cryptographic algorithm
func ED25519BytesToPublicKey ¶ added in v0.2.0
ED25519BytesToPublicKey deserializes the byte array into a jwk.JWK public key
func ED25519GeneratePrivateKey ¶
ED25519GeneratePrivateKey generates a new ED25519 private key
func ED25519PublicKeyToBytes ¶ added in v0.3.0
ED25519PublicKeyToBytes serializes the given public key int a byte array
func ED25519Sign ¶
ED25519Sign signs the given payload with the given private key
func ED25519Verify ¶
ED25519Verify verifies the given signature against the given payload using the given public key
func GeneratePrivateKey ¶
GeneratePrivateKey generates an EdDSA private key for the given algorithm
func GetJWA ¶
GetJWA returns the JWA for the given EdDSA key
Note ¶
The only supported JWA is "EdDSA"
func GetPublicKey ¶
GetPublicKey builds an EdDSA public key from the given EdDSA private key
func PublicKeyToBytes ¶ added in v0.3.0
PublicKeyToBytes serializes the given public key into a byte array
func Sign ¶
Sign generates a cryptographic signature for the given payload with the given private key
Note ¶
The function will automatically detect the given EdDSA 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.