Browse Source

crypto/hkdfchachapoly: Add testing seal to the test vector

pull/1787/head
ValarDragon 6 years ago
parent
commit
3ae878b229
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      crypto/hkdfchacha20poly1305/hkdfchachapoly_test.go

+ 4
- 0
crypto/hkdfchacha20poly1305/hkdfchachapoly_test.go View File

@ -36,12 +36,16 @@ func TestVector(t *testing.T) {
nonce := make([]byte, 24)
nonce[0] = byteArr[0]
// Test that we get the expected plaintext on open
plaintext, err := aead.Open(nil, nonce, ct, byteArr)
if err != nil {
t.Errorf("%dth Open failed", i)
continue
}
assert.Equal(t, byteArr, plaintext)
// Test that sealing yields the expected ciphertext
ciphertext := aead.Seal(nil, nonce, plaintext, byteArr)
assert.Equal(t, ct, ciphertext)
}
}


Loading…
Cancel
Save