Documentation ¶
Index ¶
- Constants
- func JWK2PrivateECDSA(j JWK) (privateKey *ecdsa.PrivateKey, err error)
- func JWK2PublicECDSA(j JWK) (publicKey *ecdsa.PublicKey, err error)
- func LoadECPrivateKeyFromJWKFile(location string) crypto.PrivateKey
- func LoadECPublicKeyFromJWKFile(location string) crypto.PublicKey
- type JWK
- func (k *JWK) AsJSON() ([]byte, error)
- func (key *JWK) GetAlg() string
- func (key *JWK) GetKid() string
- func (key *JWK) GetPrivateKey() (privateKeyEC crypto.PrivateKey, err error)
- func (key *JWK) GetPublicKey() (publicKeyEC crypto.PublicKey, err error)
- func (key *JWK) PublicJWKKey() (publicKey *JWK)
- func (k *JWK) String() (s string)
Constants ¶
View Source
const ( // P256 represents a 256-bit cryptographic elliptical curve type. P256 = "P-256" // P256K represents the Ethereum 256-bit cryptographic elliptical curve type. P256K = "P-256K" // P384 represents a 384-bit cryptographic elliptical curve type. P384 = "P-384" // P521 represents a 521-bit cryptographic elliptical curve type. P521 = "P-521" )
Variables ¶
This section is empty.
Functions ¶
func JWK2PrivateECDSA ¶
func JWK2PrivateECDSA(j JWK) (privateKey *ecdsa.PrivateKey, err error)
JWK2PrivateECDSA parses a jsonWebKey and turns it into an ECDSA private key.
func JWK2PublicECDSA ¶
JWK2PublicECDSA parses a jsonWebKey and turns it into an ECDSA public key.
func LoadECPrivateKeyFromJWKFile ¶
func LoadECPrivateKeyFromJWKFile(location string) crypto.PrivateKey
Types ¶
type JWK ¶
type JWK struct { Kid string `json:"kid"` Kty string `json:"kty"` Use string `json:"use"` Alg string `json:"alg"` // Elliptic curve, common to Public and Private keys Crv string `json:"crv"` X string `json:"x"` Y string `json:"y"` // RSA curve, common to Public and Private keys N string `json:"n"` // Modulus. Base64urlUInt-encoded E string `json:"e"` // Exponent. Base64urlUInt-encoded // For Private Keys, both Elliptic and RSA D string `json:"d"` }
func NewEthereum ¶
func NewFromBytes ¶
func NewJWKFromFile ¶
func (*JWK) GetPrivateKey ¶
func (key *JWK) GetPrivateKey() (privateKeyEC crypto.PrivateKey, err error)
func (*JWK) PublicJWKKey ¶
Click to show internal directories.
Click to hide internal directories.