openssl

package
v0.0.0-...-aefe3a2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const PKCS5_PADDING = "PKCS5"
View Source
const PKCS7_PADDING = "PKCS7"
View Source
const ZEROS_PADDING = "ZEROS"

Variables

View Source
var ErrUnPadding = errors.New("UnPadding error")

Functions

func AesCBCDecrypt

func AesCBCDecrypt(src, key, iv []byte, padding string) ([]byte, error)

AesCBCDecrypt

func AesCBCEncrypt

func AesCBCEncrypt(src, key, iv []byte, padding string) ([]byte, error)

AesCBCEncrypt

func AesECBDecrypt

func AesECBDecrypt(src, key []byte, padding string) ([]byte, error)

AesECBDecrypt

func AesECBEncrypt

func AesECBEncrypt(src, key []byte, padding string) ([]byte, error)

AesECBEncrypt

func AesNewCipher

func AesNewCipher(key []byte) (cipher.Block, error)

AesNewCipher creates and returns a new AES cipher.Block. it will automatically pad the length of the key.

func CBCDecrypt

func CBCDecrypt(block cipher.Block, src, iv []byte, padding string) ([]byte, error)

CBCDecrypt

func CBCEncrypt

func CBCEncrypt(block cipher.Block, src, iv []byte, padding string) ([]byte, error)

CBCEncrypt

func Des3CBCDecrypt

func Des3CBCDecrypt(src, key, iv []byte, padding string) ([]byte, error)

Des3CBCDecrypt

func Des3CBCEncrypt

func Des3CBCEncrypt(src, key, iv []byte, padding string) ([]byte, error)

Des3CBCEncrypt

func Des3ECBDecrypt

func Des3ECBDecrypt(src, key []byte, padding string) ([]byte, error)

Des3ECBDecrypt

func Des3ECBEncrypt

func Des3ECBEncrypt(src, key []byte, padding string) ([]byte, error)

Des3ECBEncrypt

func DesCBCDecrypt

func DesCBCDecrypt(src, key, iv []byte, padding string) ([]byte, error)

DesCBCDecrypt

func DesCBCEncrypt

func DesCBCEncrypt(src, key, iv []byte, padding string) ([]byte, error)

DesCBCEncrypt

func DesECBDecrypt

func DesECBDecrypt(src, key []byte, padding string) ([]byte, error)

DesECBDecrypt

func DesECBEncrypt

func DesECBEncrypt(src, key []byte, padding string) ([]byte, error)

DesECBEncrypt

func DesNewCipher

func DesNewCipher(key []byte) (cipher.Block, error)

DesNewCipher creates and returns a new DES cipher.Block.

func ECBDecrypt

func ECBDecrypt(block cipher.Block, src []byte, padding string) ([]byte, error)

func ECBEncrypt

func ECBEncrypt(block cipher.Block, src []byte, padding string) ([]byte, error)

func HmacSha1

func HmacSha1(key string, data string) []byte

HmacSha1 Calculate the sha1 hash of a string using the HMAC method

func HmacSha1ToString

func HmacSha1ToString(key string, data string) string

HmacSha1ToString Calculate the sha1 hash of a string using the HMAC method, outputs lowercase hexits

func HmacSha256

func HmacSha256(key string, data string) []byte

HmacSha256 Calculate the sha256 hash of a string using the HMAC method

func HmacSha256ToString

func HmacSha256ToString(key string, data string) string

HmacSha256ToString Calculate the sha256 hash of a string using the HMAC method, outputs lowercase hexits

func KeyGenerator

func KeyGenerator(src []byte, blockSize int) []byte

func Md5

func Md5(str string) []byte

Md5 Calculate the md5 hash of a string

func Md5ToString

func Md5ToString(str string) string

Md5ToString Calculate the md5 hash of a string, return hex string

func NewECBDecrypter

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.

func PKCS5Padding

func PKCS5Padding(src []byte, blockSize int) []byte

func PKCS5Unpadding

func PKCS5Unpadding(src []byte) ([]byte, error)

func PKCS7Padding

func PKCS7Padding(src []byte, blockSize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(src []byte) ([]byte, error)

func Padding

func Padding(padding string, src []byte, blockSize int) []byte

func RSADecrypt

func RSADecrypt(src, priKey []byte) ([]byte, error)

RSADecrypt RSA decrypt

func RSAEncrypt

func RSAEncrypt(src, pubKey []byte) ([]byte, error)

RSAEncrypt RSA encrypt

func RSAGenerateKey

func RSAGenerateKey(bits int, out io.Writer) error

RSAGenerateKey generate RSA private key

func RSAGeneratePublicKey

func RSAGeneratePublicKey(priKey []byte, out io.Writer) error

RSAGeneratePublicKey generate RSA public key

func RSASign

func RSASign(src []byte, priKey []byte, hash crypto.Hash) ([]byte, error)

RSASign RSA sign

func RSAVerify

func RSAVerify(src, sign, pubKey []byte, hash crypto.Hash) error

RSAVerify RSA verify

func SHA1

func SHA1(data []byte) []byte

func Sha1

func Sha1(str string) []byte

Sha1 Calculate the sha1 hash of a string

func Sha256

func Sha256(str string) []byte

Sha256 Calculate the sha256 hash of a string

func UnPadding

func UnPadding(padding string, src []byte) ([]byte, error)

func ZerosPadding

func ZerosPadding(src []byte, blockSize int) []byte

func ZerosUnPadding

func ZerosUnPadding(src []byte) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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