xrsa

package
v1.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatAlipayPrivateKey added in v1.0.8

func FormatAlipayPrivateKey(privateKey string) (pKey string)

FormatAlipayPrivateKey 格式化支付宝普通应用秘钥

func FormatAlipayPublicKey added in v1.0.8

func FormatAlipayPublicKey(publicKey string) (pKey string)

FormatAlipayPublicKey 格式化支付宝普通支付宝公钥

func RsaDecryptData

func RsaDecryptData(cipherData string, privateKeyFilePath string) (originData string, err error)

Deprecated 推荐使用:RsaDecryptDataV2() RSA解密数据

cipherData:加密字符串
privateKeyFilePath:私钥证书文件路径

func RsaDecryptDataV2 added in v1.0.10

func RsaDecryptDataV2(t PKCSType, cipherData []byte, privateKey string) (originData []byte, err error)

RSA解密数据

t:PKCS1 或 PKCS8
cipherData:加密字符串byte数组
privateKey:私钥

func RsaDecryptOAEPData added in v1.0.8

func RsaDecryptOAEPData(h hash.Hash, t PKCSType, privateKey string, ciphertext, label []byte) (originData []byte, err error)

RSA解密数据

OAEPWithSHA-256AndMGF1Padding

func RsaEncryptData

func RsaEncryptData(originData string, publicKeyFilePath string) (cipherData string, err error)

Deprecated 推荐使用:RsaEncryptDataV2() RSA加密数据

originData:原始字符串
publicKeyFilePath:公钥证书文件路径

func RsaEncryptDataV2 added in v1.0.10

func RsaEncryptDataV2(t PKCSType, originData []byte, publicKey string) (cipherData []byte, err error)

RSA加密数据

t:PKCS1 或 PKCS8
originData:原始字符串byte数组
publicKey:公钥

func RsaEncryptOAEPData added in v1.0.8

func RsaEncryptOAEPData(h hash.Hash, t PKCSType, publicKey string, originData, label []byte) (cipherData []byte, err error)

RSA加密数据

OAEPWithSHA-256AndMGF1Padding

Types

type PKCSType added in v1.0.8

type PKCSType uint8
const (
	PKCS1 PKCSType = 1 // 非java适用
	PKCS8 PKCSType = 2 // java适用
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL