-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrsaSha256.go
More file actions
26 lines (20 loc) · 731 Bytes
/
rsaSha256.go
File metadata and controls
26 lines (20 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package httpsignatures
import (
"crypto"
"crypto/sha256"
)
const algRsaSha256 = "RSA-SHA256"
// RsaSha256 RSA-SHA265 Algorithm
type RsaSha256 struct{}
// Algorithm Return algorithm name
func (a RsaSha256) Algorithm() string {
return algRsaSha256
}
// Create Create signature using passed privateKey from secret
func (a RsaSha256) Create(secret Secret, data []byte) ([]byte, error) {
return signatureRsaAlgorithmCreate(algRsaSha256, sha256.New, crypto.SHA256, secret, data)
}
// Verify Verify signature using passed publicKey from secret
func (a RsaSha256) Verify(secret Secret, data []byte, signature []byte) error {
return signatureRsaAlgorithmVerify(algRsaSha256, sha256.New, crypto.SHA256, secret, data, signature)
}