forked from quic-go/quic-go
add test for RSA proof
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
package crypto_test
|
||||
package crypto
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/crypto"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
@@ -15,7 +14,7 @@ var _ = Describe("Crypto/NullAEAD", func() {
|
||||
plainText := []byte("They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.")
|
||||
hash := []byte{0x98, 0x9b, 0x33, 0x3f, 0xe8, 0xde, 0x32, 0x5c, 0xa6, 0x7f, 0x9c, 0xf7}
|
||||
cipherText := append(hash, plainText...)
|
||||
aead := &crypto.NullAEAD{}
|
||||
aead := &NullAEAD{}
|
||||
r, err := aead.Open(aad, bytes.NewReader(cipherText))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
res, err := ioutil.ReadAll(r)
|
||||
@@ -28,7 +27,7 @@ var _ = Describe("Crypto/NullAEAD", func() {
|
||||
plainText := []byte("They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.")
|
||||
hash := []byte{0x98, 0x9b, 0x33, 0x3f, 0xe8, 0xde, 0x32, 0x5c, 0xa6, 0x7f, 0x9c, 0xf7}
|
||||
cipherText := append(hash, plainText...)
|
||||
aead := &crypto.NullAEAD{}
|
||||
aead := &NullAEAD{}
|
||||
_, err := aead.Open(aad, bytes.NewReader(cipherText))
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
@@ -37,7 +36,7 @@ var _ = Describe("Crypto/NullAEAD", func() {
|
||||
aad := []byte("All human beings are born free and equal in dignity and rights.")
|
||||
plainText := []byte("They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.")
|
||||
b := &bytes.Buffer{}
|
||||
aead := &crypto.NullAEAD{}
|
||||
aead := &NullAEAD{}
|
||||
aead.Seal(b, aad, plainText)
|
||||
Expect(b.Bytes()).To(Equal(append([]byte{0x98, 0x9b, 0x33, 0x3f, 0xe8, 0xde, 0x32, 0x5c, 0xa6, 0x7f, 0x9c, 0xf7}, []byte("They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.")...)))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user