Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurvePoint ¶
CurvePoint represents the parameters for a ECDSA Curve
type ECDSASignerVerifier ¶
type ECDSASignerVerifier struct {
// contains filtered or unexported fields
}
ECDSASignerVerifier implements a Signer-Verifier after JWA RFC 7518 Section 3.4
func NewECDSASignerVerifier ¶
func NewECDSASignerVerifier(hashtype crypto.Hash) (*ECDSASignerVerifier, error)
NewECDSASignerVerifier creates a New ECDSASignerVerifier and selects a curve based on the given Hash Function
func NewECDSASignerVerifierWithKey ¶
func NewECDSASignerVerifierWithKey(key *ecdsa.PrivateKey) (*ECDSASignerVerifier, error)
NewECDSASignerVerifierWithKey create a new ECDSASignerVerifier and selects a hash based on the given ECDSA private key
func (*ECDSASignerVerifier) Alg ¶
func (sv *ECDSASignerVerifier) Alg() string
Alg returns the the Algorithm used for Signing after JWA 3.1
type HSSignerVerifier ¶
type HSSignerVerifier struct {
// contains filtered or unexported fields
}
HSSignerVerifier implements the HMAC SHA-2 Signer (JWA RFC 7518 Section 3.2)
func NewHSSignerVerifier ¶
func NewHSSignerVerifier(hashtype crypto.Hash) (*HSSignerVerifier, error)
NewHSSignerVerifier returns a new SignerVerifier using HMAC and a SHA2 function crypto.SHA256, crypto.SHA384, crypto.SHA512 are supported
func NewHSSignerVerifierWithKey ¶
func NewHSSignerVerifierWithKey(key []byte, hashtype crypto.Hash) (*HSSignerVerifier, error)
NewHSSignerVerifierWithKey returns a new HSSignerVerifier given a key They key length should be larger than the output length of the Hash Function and at least the block size of the hash function (Recommendation from RFC 4868) The absolute minimum recommended Keylength is 128 bits, smaller keys will be rejected
func (*HSSignerVerifier) Alg ¶
func (sv *HSSignerVerifier) Alg() string
Alg returns the the Algorithm used for Signing after JWA 3.1
type NoneSignerVerifier ¶
type NoneSignerVerifier struct { }
NoneSignerVerifier implements a Signer-Verifier after (JWA RFC 7518 Section 3.6)
func (*NoneSignerVerifier) Alg ¶
func (sv *NoneSignerVerifier) Alg() string
Alg returns the the Algorithm used for Signing after JWA 3.1
type RSAPSSSignerVerifier ¶
type RSAPSSSignerVerifier struct {
// contains filtered or unexported fields
}
RSAPSSSignerVerifier implements a Signer-Verifier after (JWA RFC 7518 Section 3.5)
func NewRSAPSSSignerVerifier ¶
func NewRSAPSSSignerVerifier(hashtype crypto.Hash) (*RSAPSSSignerVerifier, error)
NewRSAPSSSignerVerifier creates a new RSAPSSSignerVerifier and creates a 4096 bit RSA key
func NewRSAPSSSignerVerifierWithKey ¶
func NewRSAPSSSignerVerifierWithKey(hashtype crypto.Hash, key *rsa.PrivateKey) (*RSAPSSSignerVerifier, error)
NewRSAPSSSignerVerifierWithKey createss a new RSAPSSSignerVerifier using the given hashtype and the given RSA private key
func (*RSAPSSSignerVerifier) Alg ¶
func (sv *RSAPSSSignerVerifier) Alg() string
Alg returns the the Algorithm used for Signing after JWA 3.1
type RSASSASignerVerifier ¶
type RSASSASignerVerifier struct {
// contains filtered or unexported fields
}
RSASSASignerVerifier implements a Signer-Verifier after (JWA RFC 7518 Section 3.3)
func NewRSASSASignerVerifier ¶
func NewRSASSASignerVerifier(hashtype crypto.Hash) (*RSASSASignerVerifier, error)
NewRSASSASignerVerifier creates a new RSASSASignerVerifier with the given hash function and a generated 4096 bit RSA key
func NewRSASSASignerVerifierWithKey ¶
func NewRSASSASignerVerifierWithKey(hashtype crypto.Hash, key *rsa.PrivateKey) (*RSASSASignerVerifier, error)
NewRSASSASignerVerifierWithKey creates as new RSASSASignerVerifier According to RFC 7518 Section 3.3 the Key has to have a length of 2048 bits or more
func (*RSASSASignerVerifier) Alg ¶
func (sv *RSASSASignerVerifier) Alg() string
Alg returns the the Algorithm used for Signing after JWA 3.1
type SignerVerifier ¶
type SignerVerifier interface { Sign(payload []byte) ([]byte, error) Verify(payload []byte, messageMac []byte) (bool, error) Alg() string }
SignerVerifier is the interface for implementing the Cryptographics Algorithms for Digital Signatures and MACs according to RFC 7518 JWA Chapter 3