Documentation ¶
Overview ¶
Package subtle provides subtle implementations of the digital signature primitive.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ECDSASignature ¶
ECDSASignature is a struct holding the r and s values of an ECDSA signature.
func DecodeECDSASignature ¶
func DecodeECDSASignature(encodedBytes []byte, encoding string) (*ECDSASignature, error)
DecodeECDSASignature creates a new ECDSA signature using the given byte slice. The function assumes that the byte slice is the concatenation of the BigEndian representation of two big integer r and s.
func NewECDSASignature ¶
func NewECDSASignature(r, s *big.Int) *ECDSASignature
NewECDSASignature creates a new ECDSASignature instance.
func (*ECDSASignature) EncodeECDSASignature ¶
func (sig *ECDSASignature) EncodeECDSASignature(encoding, curveName string) ([]byte, error)
EncodeECDSASignature converts the signature to the given encoding format.
type ECDSASigner ¶
type ECDSASigner struct {
// contains filtered or unexported fields
}
ECDSASigner is an implementation of Signer for ECDSA. At the moment, the implementation only accepts DER encoding.
func NewECDSASigner ¶
func NewECDSASigner(hashAlg string, curve string, encoding string, keyValue []byte) (*ECDSASigner, error)
NewECDSASigner creates a new instance of ECDSASigner.
func NewECDSASignerFromPrivateKey ¶
func NewECDSASignerFromPrivateKey(hashAlg string, encoding string, privateKey *ecdsa.PrivateKey) (*ECDSASigner, error)
NewECDSASignerFromPrivateKey creates a new instance of ECDSASigner
type ECDSAVerifier ¶
type ECDSAVerifier struct {
// contains filtered or unexported fields
}
ECDSAVerifier is an implementation of Verifier for ECDSA. At the moment, the implementation only accepts signatures with strict DER encoding.
func NewECDSAVerifier ¶
func NewECDSAVerifier(hashAlg string, curve string, encoding string, x []byte, y []byte) (*ECDSAVerifier, error)
NewECDSAVerifier creates a new instance of ECDSAVerifier.
func NewECDSAVerifierFromPublicKey ¶
func NewECDSAVerifierFromPublicKey(hashAlg string, encoding string, publicKey *ecdsa.PublicKey) (*ECDSAVerifier, error)
NewECDSAVerifierFromPublicKey creates a new instance of ECDSAVerifier.
func (*ECDSAVerifier) Verify ¶
func (e *ECDSAVerifier) Verify(signatureBytes, data []byte) error
Verify verifies whether the given signature is valid for the given data. It returns an error if the signature is not valid; nil otherwise.
type ED25519Signer ¶
type ED25519Signer struct {
// contains filtered or unexported fields
}
ED25519Signer is an implementation of Signer for ED25519.
func NewED25519Signer ¶
func NewED25519Signer(keyValue []byte) (*ED25519Signer, error)
NewED25519Signer creates a new instance of ED25519Signer.
func NewED25519SignerFromPrivateKey ¶
func NewED25519SignerFromPrivateKey(privateKey *ed25519.PrivateKey) (*ED25519Signer, error)
NewED25519SignerFromPrivateKey creates a new instance of ED25519Signer
type ED25519Verifier ¶
type ED25519Verifier struct {
// contains filtered or unexported fields
}
ED25519Verifier is an implementation of Verifier for ED25519. At the moment, the implementation only accepts signatures with strict DER encoding.
func NewED25519Verifier ¶
func NewED25519Verifier(pub []byte) (*ED25519Verifier, error)
NewED25519Verifier creates a new instance of ED25519Verifier.
func NewED25519VerifierFromPublicKey ¶
func NewED25519VerifierFromPublicKey(publicKey *ed25519.PublicKey) (*ED25519Verifier, error)
NewED25519VerifierFromPublicKey creates a new instance of ED25519Verifier.
func (*ED25519Verifier) Verify ¶
func (e *ED25519Verifier) Verify(signature, data []byte) error
Verify verifies whether the given signature is valid for the given data. It returns an error if the signature is not valid; nil otherwise.