-
Notifications
You must be signed in to change notification settings - Fork 28
/
plaintext.go
38 lines (27 loc) · 729 Bytes
/
plaintext.go
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
27
28
29
30
31
32
33
34
35
36
37
38
package jose
import (
"errors"
)
// Plaintext (no signing) signing algorithm implementation
type Plaintext struct{}
func init() {
RegisterJws(new(Plaintext))
}
func (alg *Plaintext) Name() string {
return NONE
}
func (alg *Plaintext) Verify(securedInput []byte, signature []byte, key interface{}) error {
if key != nil {
return errors.New("Plaintext.Verify() expects key to be nil")
}
if len(signature) != 0 {
return errors.New("Plaintext.Verify() expects signature to be empty.")
}
return nil
}
func (alg *Plaintext) Sign(securedInput []byte, key interface{}) (signature []byte, err error) {
if key != nil {
return nil, errors.New("Plaintext.Verify() expects key to be nil")
}
return []byte{}, nil
}