...
1 package rsa
2
3 import (
4 "crypto"
5 "crypto/rsa"
6 "io"
7
8 "github.com/cloudflare/circl/tss/rsa/internal"
9 pss2 "github.com/cloudflare/circl/tss/rsa/internal/pss"
10 )
11
12 type Padder interface {
13 Pad(pub *rsa.PublicKey, hash crypto.Hash, hashed []byte) ([]byte, error)
14 }
15
16 type PKCS1v15Padder struct{}
17
18 func (PKCS1v15Padder) Pad(pub *rsa.PublicKey, hash crypto.Hash, hashed []byte) ([]byte, error) {
19 return internal.PadPKCS1v15(pub, hash, hashed)
20 }
21
22
23
24
25
26
27
28
29
30
31 type PSSPadder struct {
32 Rand io.Reader
33 Opts *rsa.PSSOptions
34 }
35
36 func (pss *PSSPadder) Pad(pub *rsa.PublicKey, hash crypto.Hash, hashed []byte) ([]byte, error) {
37 return pss2.PadPSS(pss.Rand, pub, hash, hashed, pss.Opts)
38 }
39
View as plain text