cryptography

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: MIT Imports: 6 Imported by: 0

README

Cryptography

Cryptography is a symmetric key cryptography library. This type of encryption uses the same key to encrypt and also to decrypt messages.

To create a new encryption it is necessary to pass the key and the unique number (nonce) as a parameter.

key required 16 digits,

nonce required 12 digits.

Installation

go get github.com/facily-tech/go-core/cryptography

Documentation

Overview

Package cryptography was made to encrypt sensitive data.

Package cryptography is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cryptography

type Cryptography struct {
	// contains filtered or unexported fields
}

Cryptography struct.

func NewCryptography

func NewCryptography(key []byte, nonce []byte) *Cryptography

NewCryptography returns a new Cryptography struct.

func (*Cryptography) Decrypt

func (s *Cryptography) Decrypt(ciphertext string) (string, error)

Decrypt will decrypt a ciphertext previously encrypted.

func (*Cryptography) Encrypt

func (s *Cryptography) Encrypt(plainText string) (string, error)

Encrypt will encrypt a plaintext.

type ICryptography

type ICryptography interface {
	/* Encrypt returns a string with the plainText encrypted
	   if "plainText" was a error then it will return a empty string and a error */
	Encrypt(string) (string, error)
	/* Decrypt returns a string with the ciphertext decrypted
	   if "ciphertext" was a error then it will return a empty string and a error */
	Decrypt(string) (string, error)
}

ICryptography is Cryptography interface to use when you wanna make a default setup on its methods. nolint:lll // go generate line go:generate mockgen -source=/cryptography/cryptography.go -destination=/cryptography/cryptography_mock.go -package=cryptography

type MockICryptography

type MockICryptography struct {
	// contains filtered or unexported fields
}

MockICryptography is a mock of ICryptography interface.

func NewMockICryptography

func NewMockICryptography(ctrl *gomock.Controller) *MockICryptography

NewMockICryptography creates a new mock instance.

func (*MockICryptography) Decrypt

func (m *MockICryptography) Decrypt(arg0 string) (string, error)

Decrypt mocks base method.

func (*MockICryptography) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockICryptography) Encrypt

func (m *MockICryptography) Encrypt(arg0 string) (string, error)

Encrypt mocks base method.

type MockICryptographyMockRecorder

type MockICryptographyMockRecorder struct {
	// contains filtered or unexported fields
}

MockICryptographyMockRecorder is the mock recorder for MockICryptography.

func (*MockICryptographyMockRecorder) Decrypt

func (mr *MockICryptographyMockRecorder) Decrypt(arg0 interface{}) *gomock.Call

Decrypt indicates an expected call of Decrypt.

func (*MockICryptographyMockRecorder) Encrypt

func (mr *MockICryptographyMockRecorder) Encrypt(arg0 interface{}) *gomock.Call

Encrypt indicates an expected call of Encrypt.

Jump to

Keyboard shortcuts

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