crypto

package
v6.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package crypto defines common interfaces for encryption and decryption ciphers, including string-based methods.

Package crypto defines common interfaces for encryption, decryption, and data padding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cipher

type Cipher interface {
	// Encrypt encrypts the given plainBlob and returns the encrypted data.
	Encrypt(ctx context.Context, plainBlob []byte) ([]byte, error)
	// Decrypt decrypts the given encryptedBlob and returns the original data.
	Decrypt(ctx context.Context, encryptedBlob []byte) ([]byte, error)
}

Cipher provides methods for encrypting and decrypting byte slices.

type CipherText

type CipherText interface {
	Cipher
	// EncryptString encrypts the given plaintext string and returns the encrypted string.
	EncryptString(ctx context.Context, plaintext string) (string, error)
	// DecryptString decrypts the given encryptedString and returns the original string.
	DecryptString(ctx context.Context, encryptedString string) (string, error)
}

CipherText extends the Cipher interface with methods for encrypting and decrypting strings.

type Padder

type Padder interface {
	// Pad applies padding to the given plainData and returns the padded data.
	Pad(plainData []byte) []byte
	// UnPad removes padding from the given encryptedData and returns the unpadded data.
	UnPad(encryptedData []byte) []byte
}

Padder provides methods for adding and removing padding from byte slices.

Directories

Path Synopsis
Package aes wraps the crypto/aes package cipher to provide compatibility with the Cipher interface defined under the Crypto package.
Package aes wraps the crypto/aes package cipher to provide compatibility with the Cipher interface defined under the Crypto package.
Package padding implements PKCS7 padding.
Package padding implements PKCS7 padding.

Jump to

Keyboard shortcuts

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