19 lines
327 B
Go
19 lines
327 B
Go
|
|
package rsax_test
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
"yunink/app/pkg/encryptx/rsax"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
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))
|
||
|
|
}
|