crypto

package
v0.0.0-...-a26e058 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PwdKey = []byte("ABCDABCDABCDABCD")

Functions

func AesDecrypt

func AesDecrypt(data []byte, key []byte) ([]byte, error)

func AesEncrypt

func AesEncrypt(data []byte, key []byte) ([]byte, error)

func DecryptByAes

func DecryptByAes(data string) ([]byte, error)

func EncryptByAes

func EncryptByAes(data []byte) (string, error)

Types

type Rsa

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

func NewRsa

func NewRsa(publicKey, privateKey string) *Rsa

func (*Rsa) CreateKeys

func (r *Rsa) CreateKeys(keyLength int) (privateKey, publicKey string)

func (*Rsa) CreatePkcs8Keys

func (r *Rsa) CreatePkcs8Keys(keyLength int) (privateKey, publicKey string)

func (*Rsa) Decrypt

func (r *Rsa) Decrypt(data []byte) ([]byte, error)

func (*Rsa) Encrypt

func (r *Rsa) Encrypt(data []byte) ([]byte, error)

func (*Rsa) Pkcs1ToPkcs8

func (r *Rsa) Pkcs1ToPkcs8(key []byte) []byte

func (*Rsa) Sign

func (r *Rsa) Sign(data []byte, sHash crypto.Hash) ([]byte, error)

func (*Rsa) Verify

func (r *Rsa) Verify(data []byte, sign []byte, sHash crypto.Hash) bool

Jump to

Keyboard shortcuts

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