refactor: naming cleanup and crypto package improvements (#551)

* refactor: naming cleanup across all packages
This commit is contained in:
Roger
2026-04-05 16:51:56 +08:00
committed by GitHub
parent 4af2ded428
commit 410bffe643
49 changed files with 716 additions and 510 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ import (
)
// encryptWithDPAPI encrypts data using Windows DPAPI (CryptProtectData).
// This is the reverse of crypto.DecryptWithDPAPI, used only for testing.
// This is the reverse of DecryptDPAPI, used only for testing.
func encryptWithDPAPI(plaintext []byte) ([]byte, error) {
crypt32 := syscall.NewLazyDLL("Crypt32.dll")
kernel32 := syscall.NewLazyDLL("Kernel32.dll")
@@ -57,11 +57,11 @@ func TestDecryptValue_V10_Windows(t *testing.T) {
plaintext := []byte("test_secret_value")
nonce := []byte("123456789012") // 12-byte nonce
encrypted, err := crypto.AESGCMEncrypt(testAESKey, nonce, plaintext)
gcmEncrypted, err := crypto.AESGCMEncrypt(testAESKey, nonce, plaintext)
require.NoError(t, err)
// v10 format on Windows: "v10" + nonce(12) + encrypted
ciphertext := append([]byte("v10"), append(nonce, encrypted...)...)
ciphertext := append([]byte("v10"), append(nonce, gcmEncrypted...)...)
got, err := decryptValue(testAESKey, ciphertext)
require.NoError(t, err)