listening to "garoche ta sacoche"
This commit is contained in:
1 parent
0095eb7159
commit
d863dc3bd1
7 files changed
+158
-37
No files matched your search
@@ -13,19 +13,6 @@ import (
|
||||
"github.com/didiercrunch/filou/payload"
|
||||
)
|
||||
|
||||
type mockEncryptor struct{}
|
||||
|
||||
func (this *mockEncryptor) Encrypt(data []byte) ([]byte, error) {
|
||||
// cesar encryption!
|
||||
ret := make([]byte, len(data))
|
||||
for i, d := range data {
|
||||
ret[i] = d + 3 // modulo is implicit
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
type mockSigner struct{}
|
||||
|
||||
var random = helper.NewMockRandomReader()
|
||||
|
||||
func generateRSAKeyPair() (*rsa.PrivateKey, *rsa.PublicKey) {
|
||||
@@ -42,15 +29,6 @@ func getEncryterAndSigner() *asymetric.RsaOaepPss {
|
||||
return &asymetric.RsaOaepPss{alicePrivateKey, bobPubKey, crypto.SHA512, random}
|
||||
}
|
||||
|
||||
func (this *mockSigner) Sign(data []byte) ([]byte, error) {
|
||||
// a slice with the sum of the data plus a "secret" value
|
||||
var sum byte = 36
|
||||
for _, d := range data {
|
||||
sum += d
|
||||
}
|
||||
return []byte{sum}, nil
|
||||
}
|
||||
|
||||
func TestPayloadCanBeUseInEnvelop(t *testing.T) {
|
||||
encryterAndSigner := getEncryterAndSigner()
|
||||
payload_ := payload.GetDefaultPayload(bytes.NewBufferString("some data to encrypt"))
|
||||
|
||||
Reference in new issue
Block a user