bsencrypt

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: MIT Imports: 9 Imported by: 1

README

Build

Build Status Go Report Card

QA

Quality Gate Status codecov Reliability Rating

Security

Security Rating Vulnerabilities

BSEncrypt

Encryption package with implementation of multiple standard encryption algorithms

Documentation

Index

Constants

View Source
const BSENCRPT0001EncKeyIsNotSet = "BSENCRPT0001: Encryption key is not created, encryption/decryption is not possible"

BSENCRPT0001EncKeyIsNotSet - BSENCRPT0001: Password is not set, encryption/decryption is not possible

View Source
const BSENCRPT0002WrongKeyLength = "BSENCRPT0002: key length is wrong"

BSENCRPT0002WrongKeyLength - BSENCRPT0002: key length is wrong

Variables

View Source
var Ciphers = []BSCipher{
	new(cipherAES256),
	new(cypherNONE),
}

Ciphers - Add newly implemented cyphers here with `Cyphers append(Cyphers, new(cypherImplementationHere))`

Functions

This section is empty.

Types

type BSCipher

type BSCipher interface {
	CleanAndInit() // Full clean and initialization of the entity

	// SetPassword  should be called before using encryption
	SetPassword(string) error    // Password should be set before starting encryption/decryption
	SetPasswordKey([]byte) error // Setting key from bytes array
	GetPasswordKey() []byte      // Get password current key
	IsPasswordSet() bool         // Check if password is set and entity is ready to work

	Encrypt(string) (string, error) // Encrypt string, return encrypted base64 string
	Decrypt(string) (string, error) // Decrypt string, encrypted base64 string should be provided as input

	EncryptBLOB(string) ([]byte, error) // Encrypt string, return encrypted bytes
	DecryptBLOB([]byte) (string, error) // Decrypt encrypted bytes, return string

	EncryptBIN([]byte) ([]byte, error) // Encrypt bytes array, return encrypted bytes
	DecryptBIN([]byte) ([]byte, error) // Decrypt encrypted bytes, return bytes array

	GetCryptID() string    // Unique ID of cipher implementation, use any alphanumeric symbols, 8 chars
	GetCipherName() string // Human readable name of the implemented cypher
}

BSCipher - Cipher interface, implement all the methods to attach new cypher to bykovstorage

Jump to

Keyboard shortcuts

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