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