encapsulate object storage service operations

This commit is contained in:
2025-01-17 18:42:36 +08:00
parent e31f95b943
commit eab806fb9b
78 changed files with 4178 additions and 5275 deletions

View File

@@ -0,0 +1,26 @@
package encrypt
import (
"fmt"
"log"
"testing"
)
func TestAES(t *testing.T) {
key := "thisisasecretkey" // 16 字节密钥
plainText := "Hello, AES-GCM encryption!"
// 加密
encrypted, err := Encrypt(plainText, key)
if err != nil {
log.Fatalf("加密失败: %v", err)
}
fmt.Printf("加密结果: %s\n", encrypted)
// 解密
decrypted, err := Decrypt(encrypted, key)
if err != nil {
log.Fatalf("解密失败: %v", err)
}
fmt.Printf("解密结果: %s\n", decrypted)
}