Initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package crypt
|
||||
|
||||
import (
|
||||
"stat/common/log"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var (
|
||||
PlatPublicKey = `
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCWtWnWmTgLemO+GBMWIX9N5yx2
|
||||
YMc+4MczBogNdTFjF4rrd/+Y1G9qJ8ZDHR7qjBQgJjzcZrGYRUf2wiY6T9ble9+h
|
||||
s14pYPpXqkSoD2VOQI4+idb6nRgVQ6rXyMQps7ORcshmEtIS/Ra3aG3XaAFAUCfO
|
||||
E3nHGyldtNIGvuBTAQIDAQAB
|
||||
-----END PUBLIC KEY-----`
|
||||
)
|
||||
|
||||
func TestRSA(t *testing.T) {
|
||||
//data := make([]byte, 0)
|
||||
testData := "是对的发送打赏打赏打赏打赏的"
|
||||
rawContext, err := RSAEncryptByPublicKey(PlatPublicKey, []byte(testData))
|
||||
if err != nil {
|
||||
log.Error("wnth RSAEncryptByPublicKey err", log.Any("err", err))
|
||||
return
|
||||
}
|
||||
log.Info(string(rawContext))
|
||||
}
|
||||
Reference in New Issue
Block a user