github.com/iikira/iikira-go-utils@v0.0.0-20230610031953-f2cb11cde33a/utils/bdcrypto/bdcrypto.go (about)

     1  package bdcrypto
     2  
     3  import (
     4  	"encoding/hex"
     5  )
     6  
     7  // RSAEncryptOfWapBaidu 针对 WAP 登录百度的 RSA 加密
     8  func RSAEncryptOfWapBaidu(rsaPublicKeyModulus string, origData []byte) (string, error) {
     9  	ciphertext, err := RSAEncryptNoPadding(rsaPublicKeyModulus, DefaultRSAPublicKeyExponent, BytesReverse(origData))
    10  	if err != nil {
    11  		return "", err
    12  	}
    13  
    14  	return hex.EncodeToString(ciphertext), nil
    15  }