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