Documentation ¶
Index ¶
- type CryptoS
- func (s *CryptoS) Decrypt() *CryptoS
- func (s *CryptoS) Encrypt() *CryptoS
- func (s *CryptoS) IVFromBase64String(data string) *CryptoS
- func (s *CryptoS) IVFromBytes(data []byte) *CryptoS
- func (s *CryptoS) IVFromHexString(data string) *CryptoS
- func (s *CryptoS) IVFromString(data string) *CryptoS
- func (s *CryptoS) InputFromBase64String(data string) *CryptoS
- func (s *CryptoS) InputFromBytes(data []byte) *CryptoS
- func (s *CryptoS) InputFromHexString(data string) *CryptoS
- func (s *CryptoS) InputFromString(data string) *CryptoS
- func (s *CryptoS) KeyFromBase64String(data string) *CryptoS
- func (s *CryptoS) KeyFromBytes(data []byte) *CryptoS
- func (s *CryptoS) KeyFromHexString(data string) *CryptoS
- func (s *CryptoS) KeyFromString(data string) *CryptoS
- func (s *CryptoS) NewCipher() (cipher.Block, error)
- func (s *CryptoS) Reset()
- func (s *CryptoS) ToBase64String() (string, error)
- func (s *CryptoS) ToBytes() ([]byte, error)
- func (s *CryptoS) ToHexString() (string, error)
- func (s *CryptoS) ToString() (string, error)
- func (s *CryptoS) Validate(blockSize int) error
- func (s *CryptoS) WithIV(data []byte) *CryptoS
- func (s *CryptoS) WithKey(data []byte) *CryptoS
- func (s *CryptoS) WithMethod(method method.MethodType) *CryptoS
- func (s *CryptoS) WithMode(mode mode.ModeType) *CryptoS
- func (s *CryptoS) WithPadding(padding padding.PaddingType) *CryptoS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CryptoS ¶
type CryptoS struct { // InputData is the data to be encrypted. InputData []byte // OutputData is the data encrypted. OutputData []byte // Key is the secret used for encrypted Key []byte // An initialization vector (IV) is an arbitrary number that can be used with a secret key for data encryption // to foil cyberattacks. This number, also called a nonce (number used once), is employed only one time in // any session to prevent unauthorized decryption of the message by a suspicious or malicious actor. IV []byte // Method is the encryption method such as AES. Method method.MethodType // Mode is the encrypted mode such as ECB. Mode mode.ModeType // Padding is the padding method such as PKCS7. Padding padding.PaddingType // Errors is the errors Errors error }
CryptoS is the struct for symmetric-key algorithm.
func NewCryptoS ¶
func NewCryptoS() CryptoS
func (*CryptoS) IVFromBase64String ¶
IVFromBase64String set IV data from base64 string.
func (*CryptoS) IVFromBytes ¶
IVFromBytes set IV data from byte slice.
func (*CryptoS) IVFromHexString ¶
IVFromHexString set IV data from hex string.
func (*CryptoS) IVFromString ¶
IVFromString set IV data from string.
func (*CryptoS) InputFromBase64String ¶
InputFromBase64String set input data from base64 string.
func (*CryptoS) InputFromBytes ¶
InputFromBytes set input data from byte slice.
func (*CryptoS) InputFromHexString ¶
InputFromHexString set input data from hex string.
func (*CryptoS) InputFromString ¶
InputFromString set input data from string.
func (*CryptoS) KeyFromBase64String ¶
KeyFromBase64String set key data from base64 string.
func (*CryptoS) KeyFromBytes ¶
KeyFromBytes set key data from byte slice.
func (*CryptoS) KeyFromHexString ¶
KeyFromHexString set key data from hex string.
func (*CryptoS) KeyFromString ¶
KeyFromString set key data from string.
func (*CryptoS) ToBase64String ¶
ToBase64String output data with base64 string.
func (*CryptoS) ToHexString ¶
ToHexString output data with hex string.
func (*CryptoS) Validate ¶
Validate validates the CryptoS and returns error if it does not meet the requirements.
func (*CryptoS) WithMethod ¶
func (s *CryptoS) WithMethod(method method.MethodType) *CryptoS
WithMethod set method for CryptoS.
func (*CryptoS) WithPadding ¶
func (s *CryptoS) WithPadding(padding padding.PaddingType) *CryptoS
WithPadding set padding for CryptoS.