crypto

package
v0.0.0-...-c6e4f4a Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MulanPSL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(src []byte) (dst []byte, err error)

func Base64Encode

func Base64Encode(src []byte) (dst []byte)

func GenRsaKey

func GenRsaKey() ([]byte, []byte, error)

GenRsaKey RSA公钥私钥产生

func ParsePrivateKey

func ParsePrivateKey(key []byte) (*rsa.PrivateKey, error)

ParsePrivateKey 解析私钥

func ParsePublicKey

func ParsePublicKey(key []byte) (*rsa.PublicKey, error)

ParsePublicKey 解析公钥

Types

type AesCipher

type AesCipher struct {
	// contains filtered or unexported fields
}

func NewAesCipher

func NewAesCipher(key []byte) (*AesCipher, error)

func (*AesCipher) Decrypt

func (a *AesCipher) Decrypt(cipherText []byte) ([]byte, error)

func (*AesCipher) DecryptToString

func (a *AesCipher) DecryptToString(encrypted string) (string, error)

func (*AesCipher) Encrypt

func (a *AesCipher) Encrypt(plainText []byte) ([]byte, error)

func (*AesCipher) EncryptToString

func (a *AesCipher) EncryptToString(data string) (string, error)

type RsaCipher

type RsaCipher struct {
	// contains filtered or unexported fields
}

func NewRsaCipher

func NewRsaCipher(pubKey, priKey []byte) (*RsaCipher, error)

func (*RsaCipher) Decrypt

func (r *RsaCipher) Decrypt(cipherText []byte) ([]byte, error)

func (*RsaCipher) DecryptToString

func (r *RsaCipher) DecryptToString(cipherText string) (string, error)

func (*RsaCipher) Encrypt

func (r *RsaCipher) Encrypt(plainText []byte) ([]byte, error)

func (*RsaCipher) EncryptToString

func (r *RsaCipher) EncryptToString(plainText string) (string, error)

func (*RsaCipher) Sign

func (r *RsaCipher) Sign(text []byte) ([]byte, error)

func (*RsaCipher) VerifySign

func (r *RsaCipher) VerifySign(text, signature []byte) (bool, error)

Jump to

Keyboard shortcuts

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