2023-09-16 20:14:20 +08:00
|
|
|
package rsax_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"testing"
|
2023-09-17 18:05:01 +08:00
|
|
|
|
|
|
|
|
"code.yun.ink/open/utils/encryptx/rsax"
|
2023-09-16 20:14:20 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestRsa(t *testing.T) {
|
|
|
|
|
//加密
|
|
|
|
|
data := []byte("hello world")
|
|
|
|
|
encrypt := rsax.RSA_Encrypt(data, "public.pem")
|
|
|
|
|
fmt.Println(string(encrypt))
|
|
|
|
|
|
|
|
|
|
// 解密
|
|
|
|
|
decrypt := rsax.RSA_Decrypt(encrypt, "private.pem")
|
|
|
|
|
fmt.Println(string(decrypt))
|
|
|
|
|
}
|