MCPcopy Create free account
hub / github.com/Driver-C/tryssh / TestDecrypt_WrongKey

Function TestDecrypt_WrongKey

pkg/utils/crypto_test.go:64–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestDecrypt_WrongKey(t *testing.T) {
65 key1 := make([]byte, 32)
66 for i := range key1 {
67 key1[i] = byte(i)
68 }
69 key2 := make([]byte, 32)
70 for i := range key2 {
71 key2[i] = byte(i + 1)
72 }
73
74 encrypted, err := Encrypt("secret", key1)
75 assert.NoError(t, err)
76
77 _, err = Decrypt(encrypted, key2)
78 assert.Error(t, err)
79}
80
81func TestIsEncrypted(t *testing.T) {
82 assert.True(t, IsEncrypted("enc:somedata"))

Callers

nothing calls this directly

Calls 2

EncryptFunction · 0.85
DecryptFunction · 0.85

Tested by

no test coverage detected