cryptoutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustParseASN1RSAPublicKey

func MustParseASN1RSAPublicKey(data []byte) *rsa.PublicKey

MustParseASN1RSAPublicKey is like ParseASN1RSAPublicKey but panics instead of returning an error.

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 ParseASN1RSAPublicKey

func ParseASN1RSAPublicKey(data []byte) (*rsa.PublicKey, error)

ParseASN1RSAPublicKey parses a DER encoded RSA public key

func RSAEncrypt

func RSAEncrypt(pubkey *rsa.PublicKey, msg []byte) ([]byte, error)

Encrypts a message with the given public key using RSA-OAEP and the SHA1 hash function.

func SHA1String

func SHA1String(data []byte) string

func SHA1Sum

func SHA1Sum(data []byte) []byte

func SymmetricDecrypt

func SymmetricDecrypt(ciph cipher.Block, src []byte) []byte

SymmetricDecrypt decrypts data from the reader using AES/CBC/PKCS7 with an IV prepended using AES/ECB/None. The src slice may not be used anymore.

func SymmetricEncrypt

func SymmetricEncrypt(ciph cipher.Block, src []byte) ([]byte, error)

SymmetricEncrypt performs an encryption using AES/CBC/PKCS7 with a random IV prepended using AES/ECB/None.

Types

This section is empty.

Jump to

Keyboard shortcuts

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