xrsa

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 7

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 RsaDecrypt

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

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

func RsaDecryptOAEP

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

RSA解密数据 OAEPWithSHA-256AndMGF1Padding

func RsaEncrypt

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

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

func RsaEncryptOAEP

func RsaEncryptOAEP(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