-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrsaSsaPssSha256.go
More file actions
26 lines (20 loc) · 796 Bytes
/
rsaSsaPssSha256.go
File metadata and controls
26 lines (20 loc) · 796 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 algRsaSsaPssSha256 = "RSASSA-PSS-SHA256"
// RsaSsaPssSha256 RSA-PSS-SHA256 Algorithm
type RsaSsaPssSha256 struct{}
// Algorithm Return algorithm name
func (a RsaSsaPssSha256) Algorithm() string {
return algRsaSsaPssSha256
}
// Create Create signature using passed privateKey from secret
func (a RsaSsaPssSha256) Create(secret Secret, data []byte) ([]byte, error) {
return signatureRsaAlgorithmCreate(algRsaSsaPssSha256, sha256.New, crypto.SHA256, secret, data)
}
// Verify Verify signature using passed publicKey from secret
func (a RsaSsaPssSha256) Verify(secret Secret, data []byte, signature []byte) error {
return signatureRsaAlgorithmVerify(algRsaSsaPssSha256, sha256.New, crypto.SHA256, secret, data, signature)
}