fix tests

This commit is contained in:
Andrea Franz 2019-03-13 16:33:02 +01:00
parent 526d2eaade
commit 2e910d9bb4
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
2 changed files with 5 additions and 4 deletions

View File

@ -10,7 +10,7 @@ import (
func TestNewSession(t *testing.T) {
key := hexutils.HexToBytes("404142434445464748494a4b4c4d4e4f")
keys := NewKeyProvider(key, key)
keys := NewSCP02Keys(key, key)
raw := hexutils.HexToBytes("000002650183039536622002000de9c62ba1c4c8e55fcb91b6654ce49000")
resp, err := apdu.ParseResponse(raw)
@ -25,19 +25,19 @@ func TestNewSession_BadResponse(t *testing.T) {
raw := hexutils.HexToBytes("01026982")
resp, err := apdu.ParseResponse(raw)
assert.NoError(t, err)
_, err = NewSession(&KeyProvider{}, resp, []byte{})
_, err = NewSession(&SCP02Keys{}, resp, []byte{})
assert.Error(t, err)
raw = hexutils.HexToBytes("01026983")
resp, err = apdu.ParseResponse(raw)
assert.NoError(t, err)
_, err = NewSession(&KeyProvider{}, resp, []byte{})
_, err = NewSession(&SCP02Keys{}, resp, []byte{})
assert.Error(t, err)
// bad data length
raw = hexutils.HexToBytes("01029000")
resp, err = apdu.ParseResponse(raw)
assert.NoError(t, err)
_, err = NewSession(&KeyProvider{}, resp, []byte{})
_, err = NewSession(&SCP02Keys{}, resp, []byte{})
assert.Error(t, err)
}

View File

@ -25,6 +25,7 @@ func TestSecureChannel_Send(t *testing.T) {
encKey: hexutils.HexToBytes("FDBCB1637597CF3F8F5E8263007D4E45F64C12D44066D4576EB1443D60AEF441"),
macKey: hexutils.HexToBytes("2FB70219E6635EE0958AB3F7A428BA87E8CD6E6F873A5725A55F25B102D0F1F7"),
iv: hexutils.HexToBytes("627E64358FA9BDCDAD4442BD8006E0A5"),
open: true,
}
data := hexutils.HexToBytes("D545A5E95963B6BCED86A6AE826D34C5E06AC64A1217EFFA1415A96674A82500")