crypt

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToPrivateKey

func BytesToPrivateKey(priv []byte) *rsa.PrivateKey

func BytesToPublicKey

func BytesToPublicKey(pub []byte) *rsa.PublicKey

func CBCDecryptFile

func CBCDecryptFile(password []byte, inputFile, outputFile string) error

func CBCDecryptHexFile

func CBCDecryptHexFile(password []byte, inputFile, outputFile string) error

func CBCEncryptFile

func CBCEncryptFile(password []byte, inputFile, outputFile string) error

func CBCEncryptHexFile

func CBCEncryptHexFile(password []byte, inputFile, outputFile string) error

func CreateCertificateECDSA

func CreateCertificateECDSA(key *ecdsa.PrivateKey) (*[]byte, error)

func CreateCertificateRSA

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

func DecryptWithPrivateKey

func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) []byte

func EncryptWithPublicKey

func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) []byte

func GCMDecryptFile

func GCMDecryptFile(password []byte, inputFile, outputFile string) error

func GCMEncryptFile

func GCMEncryptFile(password []byte, inputFile, outputFile string) error

func GenerateKeyECDSA

func GenerateKeyECDSA() (*ecdsa.PrivateKey, error)

func GenerateKeyPair

func GenerateKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey)

func GenerateKeyPairAndSave

func GenerateKeyPairAndSave(bits int, privFileName, pubFileName string)

func GenerateKeyRSA

func GenerateKeyRSA(bitSize int) (*rsa.PrivateKey, error)

func PKCS7Padding

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

PKCS7Padding adds PKCS#7 padding to data

func PKCS7Unpadding

func PKCS7Unpadding(plantext []byte) []byte

PKCS7Unpadding removes PKCS#7 padding from data

func PrivateKeyToBytes

func PrivateKeyToBytes(priv *rsa.PrivateKey) []byte

func PublicKeyToBytes

func PublicKeyToBytes(pub *rsa.PublicKey) []byte

func SlurpFile

func SlurpFile(fileName string) []byte

func WriteToFile

func WriteToFile(fileName string, writeBytes []byte)

Types

type Cert

type Cert struct {
	PemPath   string `binding:"required"`
	KeyPath   string `binding:"required"`
	PemBytes  []byte `binding:"required"`
	KeyBytes  []byte `binding:"required"`
	CertBytes []byte `binding:"required"`
}

func MakeRSAKeyPairAndSave

func MakeRSAKeyPairAndSave(certPath, certName string) (*Cert, error)

Jump to

Keyboard shortcuts

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