(t *testing.T)
| 120 | } |
| 121 | |
| 122 | func TestEncryptWithPublicKeyEmptyPlaintext(t *testing.T) { |
| 123 | validKey := "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUY=" |
| 124 | encrypted, err := encryptWithPublicKey(validKey, "") |
| 125 | if err != nil { |
| 126 | t.Fatalf("encryptWithPublicKey() error = %v, expected no error", err) |
| 127 | } |
| 128 | if encrypted == "" { |
| 129 | t.Error("expected non-empty ciphertext even for empty plaintext") |
| 130 | } |
| 131 | minBase64CiphertextLen := base64.StdEncoding.EncodedLen(box.AnonymousOverhead) |
| 132 | if len(encrypted) < minBase64CiphertextLen { |
| 133 | t.Errorf("encrypted length = %d, expected at least %d", len(encrypted), minBase64CiphertextLen) |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | func TestEncryptDecryptRoundTrip(t *testing.T) { |
| 138 | // Generate a real key pair for testing |
nothing calls this directly
no test coverage detected