enciphers

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const RSA_bits_1024 = 1024
View Source
const RSA_bits_2048 = 2048
View Source
const RSA_bits_3072 = 3072
View Source
const RSA_bits_4096 = 4096

Variables

This section is empty.

Functions

This section is empty.

Types

type Encipher_RSA

type Encipher_RSA struct {
	IEncipher
	// contains filtered or unexported fields
}

func NewEncipher_RSA

func NewEncipher_RSA(bits int) *Encipher_RSA

func (Encipher_RSA) Decrypt

func (e Encipher_RSA) Decrypt(key keypairs.Key, ciphertext []byte) ([]byte, error)

func (Encipher_RSA) Encrypt

func (e Encipher_RSA) Encrypt(key keypairs.Key, plaintext []byte) ([]byte, error)

func (Encipher_RSA) GetNames

func (e Encipher_RSA) GetNames() []string

type Encipher_SM2

type Encipher_SM2 struct {
	IEncipher
	// contains filtered or unexported fields
}

func NewEncipher_SM2

func NewEncipher_SM2(mode int) *Encipher_SM2

func (Encipher_SM2) Decrypt

func (e Encipher_SM2) Decrypt(key keypairs.Key, ciphertext []byte) ([]byte, error)

func (Encipher_SM2) Encrypt

func (e Encipher_SM2) Encrypt(key keypairs.Key, plaintext []byte) ([]byte, error)

func (Encipher_SM2) GetNames

func (e Encipher_SM2) GetNames() []string

type Encipher_SM2_DER

type Encipher_SM2_DER struct {
	IEncipher
}

func NewEncipher_SM2_DER

func NewEncipher_SM2_DER() *Encipher_SM2_DER

func (Encipher_SM2_DER) Decrypt

func (Encipher_SM2_DER) Decrypt(key keypairs.Key, ciphertext []byte) ([]byte, error)

func (Encipher_SM2_DER) Encrypt

func (Encipher_SM2_DER) Encrypt(key keypairs.Key, plaintext []byte) ([]byte, error)

func (Encipher_SM2_DER) GetNames

func (Encipher_SM2_DER) GetNames() []string

type IEncipher

type IEncipher interface {

	/* 算法名称 */
	GetNames() []string

	/* 加密数据 */
	Encrypt(key keypairs.Key, plaintext []byte) ([]byte, error)

	/* 解密数据 */
	Decrypt(key keypairs.Key, ciphertext []byte) ([]byte, error)
}

加密算法

Jump to

Keyboard shortcuts

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