cryptor

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package cryptor is for data encryption and decryption.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesCbcDecrypt

func AesCbcDecrypt(encrypted, key []byte) ([]byte, error)

AesCbcDecrypt decrypt data with key use AES CBC algorithm len(key) should be 16, 24 or 32.

func AesCbcEncrypt

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

AesCbcEncrypt encrypt data with key use AES CBC algorithm len(key) should be 16, 24 or 32.

func AesCfbDecrypt

func AesCfbDecrypt(encrypted, key []byte) ([]byte, error)

AesCfbDecrypt decrypt data with key use AES CFB algorithm len(encrypted) should be great than 16, len(key) should be 16, 24 or 32.

func AesCfbEncrypt

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

AesCfbEncrypt encrypt data with key use AES CFB algorithm len(key) should be 16, 24 or 32.

func AesCtrCrypt

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

AesCtrCrypt encrypt data with key use AES CTR algorithm len(key) should be 16, 24 or 32.

func AesEcbDecrypt

func AesEcbDecrypt(encrypted, key []byte) ([]byte, error)

AesEcbDecrypt decrypt data with key use AES ECB algorithm len(key) should be 16, 24 or 32.

func AesEcbEncrypt

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

AesEcbEncrypt encrypt data with key use AES ECB algorithm len(key) should be 16, 24 or 32.

func AesOfbDecrypt

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

AesOfbDecrypt decrypt data with key use AES OFB algorithm len(key) should be 16, 24 or 32.

func AesOfbEncrypt

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

AesOfbEncrypt encrypt data with key use AES OFB algorithm len(key) should be 16, 24 or 32.

func DesCbcDecrypt

func DesCbcDecrypt(encrypted, key []byte) ([]byte, error)

DesCbcDecrypt decrypt data with key use DES CBC algorithm len(key) should be 8.

func DesCbcEncrypt

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

DesCbcEncrypt encrypt data with key use DES CBC algorithm len(key) should be 8.

func DesCfbDecrypt

func DesCfbDecrypt(encrypted, key []byte) ([]byte, error)

DesCfbDecrypt decrypt data with key use DES CFB algorithm len(encrypted) should be great than 16, len(key) should be 8.

func DesCfbEncrypt

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

func DesCtrCrypt

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

DesCtrCrypt encrypt data with key use DES CTR algorithm len(key) should be 8.

func DesEcbDecrypt

func DesEcbDecrypt(encrypted, key []byte) ([]byte, error)

DesEcbDecrypt decrypt data with key use DES ECB algorithm len(key) should be 8.

func DesEcbEncrypt

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

DesEcbEncrypt encrypt data with key use DES ECB algorithm len(key) should be 8.

func DesOfbDecrypt

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

DesOfbDecrypt decrypt data with key use DES OFB algorithm len(key) should be 8.

func DesOfbEncrypt

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

DesOfbEncrypt encrypt data with key use DES OFB algorithm len(key) should be 8.

func GenerateRandomKey

func GenerateRandomKey(length int) []byte

GenerateRandomKey generates a random bytes of the specified length

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString generates a random string of the specified length

func GenerateRsaKey

func GenerateRsaKey(keySize int, priKeyFile, pubKeyFile string) error

GenerateRsaKey create rsa private and public pemo file.

func GenerateRsaKeyPair

func GenerateRsaKeyPair(keySize int) (*rsa.PrivateKey, *rsa.PublicKey)

GenerateRsaKeyPair create rsa private and public key.

func RsaDecrypt

func RsaDecrypt(data []byte, privateKeyFileName string) ([]byte, error)

RsaDecrypt decrypt data with ras algorithm.

func RsaDecryptOAEP

func RsaDecryptOAEP(ciphertext []byte, label []byte, key rsa.PrivateKey) ([]byte, error)

RsaDecryptOAEP decrypts the data with RSA-OAEP.

func RsaEncrypt

func RsaEncrypt(data []byte, pubKeyFileName string) ([]byte, error)

RsaEncrypt encrypt data with ras algorithm.

func RsaEncryptOAEP

func RsaEncryptOAEP(data []byte, label []byte, key rsa.PublicKey) ([]byte, error)

RsaEncryptOAEP encrypts the given data with RSA-OAEP.

Types

This section is empty.

Jump to

Keyboard shortcuts

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