xrsa

package
v1.5.93 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatAlipayPrivateKey

func FormatAlipayPrivateKey(privateKey string) (pKey string)

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

func FormatAlipayPublicKey

func FormatAlipayPublicKey(publicKey string) (pKey string)

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

func RsaDecryptData

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

RSA解密数据

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

func RsaDecryptOAEPData

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

RSA解密数据

OAEPWithSHA-256AndMGF1Padding

func RsaEncryptData

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

RSA加密数据

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

func RsaEncryptOAEPData

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

RSA加密数据

OAEPWithSHA-256AndMGF1Padding

Types

type PKCSType

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