sm4

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const BlockSize = 16

Variables

This section is empty.

Functions

func DecryptBlock

func DecryptBlock(key SM4Key, dst, src []byte)

func EncryptBlock

func EncryptBlock(key SM4Key, dst, src []byte)

func NewCipher

func NewCipher(key []byte) (cipher.Block, error)

NewCipher creates and returns a new cipher.Block.

func WriteKeyToPem

func WriteKeyToPem(FileName string, key SM4Key, pwd []byte) (bool, error)

func WriteKeytoMem

func WriteKeytoMem(key SM4Key, pwd []byte) ([]byte, error)

Types

type KeySizeError

type KeySizeError int

func (KeySizeError) Error

func (k KeySizeError) Error() string

type SM4Key

type SM4Key []byte

func ReadKeyFromMem

func ReadKeyFromMem(data []byte, pwd []byte) (SM4Key, error)

func ReadKeyFromPem

func ReadKeyFromPem(FileName string, pwd []byte) (SM4Key, error)

type Sm4Cipher

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

Cipher is an instance of SM4 encryption.

func (*Sm4Cipher) BlockSize

func (c *Sm4Cipher) BlockSize() int

func (*Sm4Cipher) Decrypt

func (c *Sm4Cipher) Decrypt(dst, src []byte)

func (*Sm4Cipher) Encrypt

func (c *Sm4Cipher) Encrypt(dst, src []byte)

Jump to

Keyboard shortcuts

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