pbes2

package
v1.0.5006 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AES128CBC = CipherCBC{
	// contains filtered or unexported fields
}

AES128CBC is the 128-bit key AES cipher in CBC mode.

View Source
var AES128CCM = CipherCCM{
	// contains filtered or unexported fields
}

AES128CCM is the 128-bit key AES cipher in CCM mode.

View Source
var AES128CCMIv = CipherCCMIv{
	// contains filtered or unexported fields
}

AES128CCMIv is the 128-bit key AES cipher in CCM mode.

View Source
var AES128CFB = CipherCFB{
	// contains filtered or unexported fields
}

AES128CFB is the 128-bit key AES cipher in CFB mode.

View Source
var AES128ECB = CipherECB{
	// contains filtered or unexported fields
}

AES128ECB is the 128-bit key AES cipher in ECB mode.

View Source
var AES128GCM = CipherGCM{
	// contains filtered or unexported fields
}

AES128GCM is the 128-bit key AES cipher in GCM mode.

View Source
var AES128GCMIv = CipherGCMIv{
	// contains filtered or unexported fields
}

AES128GCMIv is the 128-bit key AES cipher in GCM mode.

View Source
var AES128OFB = CipherOFB{
	// contains filtered or unexported fields
}

AES128OFB is the 128-bit key AES cipher in OFB mode.

View Source
var AES192CBC = CipherCBC{
	// contains filtered or unexported fields
}

AES192CBC is the 192-bit key AES cipher in CBC mode.

View Source
var AES192CCM = CipherCCM{
	// contains filtered or unexported fields
}

AES192CCM is the 192-bit key AES cipher in CCM mode.

View Source
var AES192CCMIv = CipherCCMIv{
	// contains filtered or unexported fields
}

AES192CCMIv is the 192-bit key AES cipher in CCM mode.

View Source
var AES192CFB = CipherCFB{
	// contains filtered or unexported fields
}

AES192CFB is the 192-bit key AES cipher in CFB mode.

View Source
var AES192ECB = CipherECB{
	// contains filtered or unexported fields
}

AES192ECB is the 192-bit key AES cipher in ECB mode.

View Source
var AES192GCM = CipherGCM{
	// contains filtered or unexported fields
}

AES192GCM is the 192-bit key AES cipher in GCM mode.

View Source
var AES192GCMIv = CipherGCMIv{
	// contains filtered or unexported fields
}

AES192GCMIv is the 192-bit key AES cipher in GCM mode.

View Source
var AES192OFB = CipherOFB{
	// contains filtered or unexported fields
}

AES192OFB is the 192-bit key AES cipher in OFB mode.

View Source
var AES256CBC = CipherCBC{
	// contains filtered or unexported fields
}

AES256CBC is the 256-bit key AES cipher in CBC mode.

View Source
var AES256CCM = CipherCCM{
	// contains filtered or unexported fields
}

AES256CCM is the 256-bit key AES cipher in CCM mode.

View Source
var AES256CCMIv = CipherCCMIv{
	// contains filtered or unexported fields
}

AES256CCMIv is the 256-bit key AES cipher in CCM mode.

View Source
var AES256CFB = CipherCFB{
	// contains filtered or unexported fields
}

AES256CFB is the 256-bit key AES cipher in CFB mode.

View Source
var AES256ECB = CipherECB{
	// contains filtered or unexported fields
}

AES256ECB is the 256-bit key AES cipher in ECB mode.

View Source
var AES256GCM = CipherGCM{
	// contains filtered or unexported fields
}

AES256GCM is the 256-bit key AES cipher in GCM mode.

View Source
var AES256GCMIv = CipherGCMIv{
	// contains filtered or unexported fields
}

AES256GCMIv is the 256-bit key AES cipher in GCM mode.

View Source
var AES256OFB = CipherOFB{
	// contains filtered or unexported fields
}

AES256OFB is the 256-bit key AES cipher in OFB mode.

View Source
var ARIA128CBC = CipherCBC{
	// contains filtered or unexported fields
}

ARIA128CBC is the 128-bit key ARIA cipher in CBC mode.

View Source
var ARIA128CCM = CipherCCM{
	// contains filtered or unexported fields
}

ARIA128CCM is the 128-bit key ARIA cipher in CCM mode.

View Source
var ARIA128CFB = CipherCFB{
	// contains filtered or unexported fields
}

ARIA128CFB is the 128-bit key ARIA cipher in CFB mode.

View Source
var ARIA128CTR = CipherCTR{
	// contains filtered or unexported fields
}

ARIA128CTR is the 128-bit key ARIA cipher in CTR mode.

View Source
var ARIA128ECB = CipherECB{
	// contains filtered or unexported fields
}

ARIA128ECB is the 128-bit key ARIA cipher in ECB mode.

View Source
var ARIA128GCM = CipherGCM{
	// contains filtered or unexported fields
}

ARIA128GCM is the 128-bit key ARIA cipher in GCM mode.

View Source
var ARIA128OFB = CipherOFB{
	// contains filtered or unexported fields
}

ARIA128OFB is the 128-bit key ARIA cipher in OFB mode.

View Source
var ARIA192CBC = CipherCBC{
	// contains filtered or unexported fields
}

ARIA192CBC is the 192-bit key ARIA cipher in CBC mode.

View Source
var ARIA192CCM = CipherCCM{
	// contains filtered or unexported fields
}

ARIA192CCM is the 192-bit key ARIA cipher in CCM mode.

View Source
var ARIA192CFB = CipherCFB{
	// contains filtered or unexported fields
}

ARIA192CFB is the 192-bit key ARIA cipher in CFB mode.

View Source
var ARIA192CTR = CipherCTR{
	// contains filtered or unexported fields
}

ARIA192CTR is the 192-bit key ARIA cipher in CTR mode.

View Source
var ARIA192ECB = CipherECB{
	// contains filtered or unexported fields
}

ARIA192ECB is the 192-bit key ARIA cipher in ECB mode.

View Source
var ARIA192GCM = CipherGCM{
	// contains filtered or unexported fields
}

ARIA192GCM is the 192-bit key ARIA cipher in GCM mode.

View Source
var ARIA192OFB = CipherOFB{
	// contains filtered or unexported fields
}

ARIA192OFB is the 192-bit key ARIA cipher in OFB mode.

View Source
var ARIA256CBC = CipherCBC{
	// contains filtered or unexported fields
}

ARIA256CBC is the 256-bit key ARIA cipher in CBC mode.

View Source
var ARIA256CCM = CipherCCM{
	// contains filtered or unexported fields
}

ARIA256CCM is the 256-bit key ARIA cipher in CCM mode.

View Source
var ARIA256CFB = CipherCFB{
	// contains filtered or unexported fields
}

ARIA256CFB is the 256-bit key ARIA cipher in CFB mode.

View Source
var ARIA256CTR = CipherCTR{
	// contains filtered or unexported fields
}

ARIA256CTR is the 256-bit key ARIA cipher in CTR mode.

View Source
var ARIA256ECB = CipherECB{
	// contains filtered or unexported fields
}

ARIA256ECB is the 256-bit key ARIA cipher in ECB mode.

View Source
var ARIA256GCM = CipherGCM{
	// contains filtered or unexported fields
}

ARIA256GCM is the 256-bit key ARIA cipher in GCM mode.

View Source
var ARIA256OFB = CipherOFB{
	// contains filtered or unexported fields
}

ARIA256OFB is the 256-bit key ARIA cipher in OFB mode.

View Source
var CipherMap = map[string]Cipher{
	"DESCBC":     DESCBC,
	"DESEDE3CBC": DESEDE3CBC,

	"RC2CBC":     RC2CBC,
	"RC2_40CBC":  RC2_40CBC,
	"RC2_64CBC":  RC2_64CBC,
	"RC2_128CBC": RC2_128CBC,

	"RC5CBC":     RC5CBC,
	"RC5_128CBC": RC5_128CBC,
	"RC5_192CBC": RC5_192CBC,
	"RC5_256CBC": RC5_256CBC,

	"AES128ECB":   AES128ECB,
	"AES128CBC":   AES128CBC,
	"AES128OFB":   AES128OFB,
	"AES128CFB":   AES128CFB,
	"AES128GCM":   AES128GCM,
	"AES128GCMIv": AES128GCMIv,
	"AES128CCM":   AES128CCM,
	"AES128CCMIv": AES128CCMIv,

	"AES192ECB":   AES192ECB,
	"AES192CBC":   AES192CBC,
	"AES192OFB":   AES192OFB,
	"AES192CFB":   AES192CFB,
	"AES192GCM":   AES192GCM,
	"AES192GCMIv": AES192GCMIv,
	"AES192CCM":   AES192CCM,
	"AES192CCMIv": AES192CCMIv,

	"AES256ECB":   AES256ECB,
	"AES256CBC":   AES256CBC,
	"AES256OFB":   AES256OFB,
	"AES256CFB":   AES256CFB,
	"AES256GCM":   AES256GCM,
	"AES256GCMIv": AES256GCMIv,
	"AES256CCM":   AES256CCM,
	"AES256CCMIv": AES256CCMIv,

	"SM4Cipher": SM4Cipher,
	"SM4ECB":    SM4ECB,
	"SM4CBC":    SM4CBC,
	"SM4OFB":    SM4OFB,
	"SM4CFB":    SM4CFB,
	"SM4CFB1":   SM4CFB1,
	"SM4CFB8":   SM4CFB8,
	"SM4GCM":    SM4GCM,
	"SM4GCMIv":  SM4GCMIv,
	"SM4CCM":    SM4CCM,
	"SM4CCMIv":  SM4CCMIv,

	"GostCipher": GostCipher,

	"ARIA128ECB": ARIA128ECB,
	"ARIA128CBC": ARIA128CBC,
	"ARIA128CFB": ARIA128CFB,
	"ARIA128OFB": ARIA128OFB,
	"ARIA128CTR": ARIA128CTR,
	"ARIA128GCM": ARIA128GCM,
	"ARIA128CCM": ARIA128CCM,

	"ARIA192ECB": ARIA192ECB,
	"ARIA192CBC": ARIA192CBC,
	"ARIA192CFB": ARIA192CFB,
	"ARIA192OFB": ARIA192OFB,
	"ARIA192CTR": ARIA192CTR,
	"ARIA192GCM": ARIA192GCM,
	"ARIA192CCM": ARIA192CCM,

	"ARIA256ECB": ARIA256ECB,
	"ARIA256CBC": ARIA256CBC,
	"ARIA256CFB": ARIA256CFB,
	"ARIA256OFB": ARIA256OFB,
	"ARIA256CTR": ARIA256CTR,
	"ARIA256GCM": ARIA256GCM,
	"ARIA256CCM": ARIA256CCM,

	"Misty1CBC": Misty1CBC,

	"Serpent128ECB": Serpent128ECB,
	"Serpent128CBC": Serpent128CBC,
	"Serpent128OFB": Serpent128OFB,
	"Serpent128CFB": Serpent128CFB,

	"Serpent192ECB": Serpent192ECB,
	"Serpent192CBC": Serpent192CBC,
	"Serpent192OFB": Serpent192OFB,
	"Serpent192CFB": Serpent192CFB,

	"Serpent256ECB": Serpent256ECB,
	"Serpent256CBC": Serpent256CBC,
	"Serpent256OFB": Serpent256OFB,
	"Serpent256CFB": Serpent256CFB,

	"SeedECB": SeedECB,
	"SeedCBC": SeedCBC,
	"SeedOFB": SeedOFB,
	"SeedCFB": SeedCFB,

	"Seed256ECB": Seed256ECB,
	"Seed256CBC": Seed256CBC,
	"Seed256OFB": Seed256OFB,
	"Seed256CFB": Seed256CFB,
}

Cipher 列表

View Source
var DESCBC = CipherCBC{
	// contains filtered or unexported fields
}

DESCBC is the 56-bit key DES cipher in CBC mode.

View Source
var DESEDE3CBC = CipherCBC{
	// contains filtered or unexported fields
}

TripleDESCBC is the 168-bit key 3DES cipher in CBC mode.

View Source
var GostCipher = CipherGostCFB{
	// contains filtered or unexported fields
}

GostCipher is the 256-bit key Gost cipher in CFB mode.

View Source
var Misty1CBC = CipherCBC{
	// contains filtered or unexported fields
}

Misty1CBC is the 128-bit key Misty1 cipher in CBC mode.

View Source
var RC2CBC = CipherRC2CBC{
	// contains filtered or unexported fields
}

RC2CBC is the [40-bit, 64-bit, 128-bit] key RC2 cipher in CBC mode. [rc2Version, keySize] = [58, 16] | [120, 8] | [160, 5]

View Source
var RC2_128CBC = RC2CBC.WithRC2Version(58).WithKeySize(16)
View Source
var RC2_40CBC = RC2CBC.WithRC2Version(160).WithKeySize(5)
View Source
var RC2_64CBC = RC2CBC.WithRC2Version(120).WithKeySize(8)
View Source
var RC5CBC = CipherRC5CBC{
	// contains filtered or unexported fields
}

RC5CBC is the [16, 24, 32] bytes key RC5 cipher in CBC mode. wordSize = [32, 64] | rounds = [8, 127]

View Source
var RC5_128CBC = RC5CBC.WithKeySize(16)
View Source
var RC5_192CBC = RC5CBC.WithKeySize(24)
View Source
var RC5_256CBC = RC5CBC.WithKeySize(32)
View Source
var SM4CBC = CipherCBC{
	// contains filtered or unexported fields
}

SM4CBC is the 128-bit key SM4 cipher in CBC mode.

View Source
var SM4CCM = CipherCCM{
	// contains filtered or unexported fields
}

SM4CCM is the 128-bit key SM4 cipher in CCM mode.

View Source
var SM4CCMIv = CipherCCMIv{
	// contains filtered or unexported fields
}

SM4CCMIv is the 128-bit key SM4 cipher in CCM mode.

View Source
var SM4CFB = CipherCFB{
	// contains filtered or unexported fields
}

SM4CFB is the 128-bit key SM4 cipher in CFB mode.

View Source
var SM4CFB1 = CipherCFB1{
	// contains filtered or unexported fields
}

SM4CFB1 is the 128-bit key SM4 cipher in CFB mode.

View Source
var SM4CFB8 = CipherCFB8{
	// contains filtered or unexported fields
}

SM4CFB8 is the 128-bit key SM4 cipher in CFB mode.

View Source
var SM4Cipher = CipherCBC{
	// contains filtered or unexported fields
}

SM4Cipher is the 128-bit key SM4 cipher in CBC mode.

View Source
var SM4ECB = CipherECB{
	// contains filtered or unexported fields
}

SM4ECB is the 128-bit key SM4 cipher in ECB mode.

View Source
var SM4GCM = CipherGCM{
	// contains filtered or unexported fields
}

SM4GCM is the 128-bit key SM4 cipher in GCM mode.

View Source
var SM4GCMIv = CipherGCMIv{
	// contains filtered or unexported fields
}

SM4GCMIv is the 128-bit key SM4 cipher in GCM mode.

View Source
var SM4OFB = CipherOFB{
	// contains filtered or unexported fields
}

SM4OFB is the 128-bit key SM4 cipher in OFB mode.

View Source
var Seed256CBC = SeedCBC.WithKeySize(32)
View Source
var Seed256CFB = SeedCFB.WithKeySize(32)
View Source
var Seed256ECB = SeedECB.WithKeySize(32)

Seed is the 256-bit key Seed cipher in ECB mode.

View Source
var Seed256OFB = SeedOFB.WithKeySize(32)
View Source
var SeedCBC = CipherCBC{
	// contains filtered or unexported fields
}

SeedCBC is the 128-bit key Seed cipher in CBC mode.

View Source
var SeedCFB = CipherCFB{
	// contains filtered or unexported fields
}

SeedCFB is the 128-bit key Seed cipher in CFB mode.

View Source
var SeedECB = CipherECB{
	// contains filtered or unexported fields
}

SeedECB is the 128-bit key Seed cipher in ECB mode.

View Source
var SeedOFB = CipherOFB{
	// contains filtered or unexported fields
}

SeedOFB is the 128-bit key Seed cipher in OFB mode.

View Source
var Serpent128CBC = CipherCBC{
	// contains filtered or unexported fields
}

Serpent128CBC is the 128-bit key Serpent cipher in CBC mode.

View Source
var Serpent128CFB = CipherCFB{
	// contains filtered or unexported fields
}

Serpent128CFB is the 128-bit key Serpent cipher in CFB mode.

View Source
var Serpent128ECB = CipherECB{
	// contains filtered or unexported fields
}

Serpent128ECB is the 128-bit key Serpent cipher in ECB mode.

View Source
var Serpent128OFB = CipherOFB{
	// contains filtered or unexported fields
}

Serpent128OFB is the 128-bit key Serpent cipher in OFB mode.

View Source
var Serpent192CBC = CipherCBC{
	// contains filtered or unexported fields
}

Serpent192CBC is the 192-bit key Serpent cipher in CBC mode.

View Source
var Serpent192CFB = CipherCFB{
	// contains filtered or unexported fields
}

Serpent192CFB is the 192-bit key Serpent cipher in CFB mode.

View Source
var Serpent192ECB = CipherECB{
	// contains filtered or unexported fields
}

Serpent192ECB is the 192-bit key Serpent cipher in ECB mode.

View Source
var Serpent192OFB = CipherOFB{
	// contains filtered or unexported fields
}

Serpent192OFB is the 192-bit key Serpent cipher in OFB mode.

View Source
var Serpent256CBC = CipherCBC{
	// contains filtered or unexported fields
}

Serpent256CBC is the 256-bit key Serpent cipher in CBC mode.

View Source
var Serpent256CFB = CipherCFB{
	// contains filtered or unexported fields
}

Serpent256CFB is the 256-bit key Serpent cipher in CFB mode.

View Source
var Serpent256ECB = CipherECB{
	// contains filtered or unexported fields
}

Serpent256ECB is the 256-bit key Serpent cipher in ECB mode.

View Source
var Serpent256OFB = CipherOFB{
	// contains filtered or unexported fields
}

Serpent256OFB is the 256-bit key Serpent cipher in OFB mode.

Functions

func AddCipher

func AddCipher(oid asn1.ObjectIdentifier, cipher CipherFunc)

添加加密

func AddGostSbox added in v1.0.2050

func AddGostSbox(name string, sbox GostSbox)

func AllCipher added in v1.0.2032

func AllCipher() map[string]CipherFunc

全部

func CheckCipher added in v1.0.2031

func CheckCipher(c Cipher) bool

检测 Cipher

func CheckCipherFromName

func CheckCipherFromName(name string) bool

检测 Cipher 类型

func GetCipherName added in v1.0.2031

func GetCipherName(c Cipher) string

获取 Cipher 类型名称

func GetGostSboxByOID added in v1.0.2050

func GetGostSboxByOID(oid asn1.ObjectIdentifier) ([][]byte, bool)

Types

type Cipher

type Cipher interface {
	// oid
	OID() asn1.ObjectIdentifier

	// 值大小
	KeySize() int

	// 是否有 KeyLength
	HasKeyLength() bool

	// 密码是否需要 Bmp 处理
	NeedBmpPassword() bool

	// 加密, 返回: [加密后数据, 参数, error]
	Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

	// 解密
	Decrypt(key, params, ciphertext []byte) ([]byte, error)
}

加密接口

func GetCipher

func GetCipher(alg any) (Cipher, error)

获取加密

func GetCipherFromName

func GetCipherFromName(name string) Cipher

获取 Cipher 类型

type CipherCBC

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

cbc 模式加密

func (CipherCBC) Decrypt

func (this CipherCBC) Decrypt(key, params, ciphertext []byte) ([]byte, error)

解密

func (CipherCBC) Encrypt

func (this CipherCBC) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherCBC) HasKeyLength added in v1.0.2039

func (this CipherCBC) HasKeyLength() bool

是否有 KeyLength

func (CipherCBC) KeySize

func (this CipherCBC) KeySize() int

值大小

func (CipherCBC) NeedBmpPassword added in v1.0.2066

func (this CipherCBC) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherCBC) OID

func (this CipherCBC) OID() asn1.ObjectIdentifier

oid

func (CipherCBC) WithHasKeyLength added in v1.0.2039

func (this CipherCBC) WithHasKeyLength(hasKeyLength bool) CipherCBC

func (CipherCBC) WithKeySize added in v1.0.2058

func (this CipherCBC) WithKeySize(keySize int) CipherCBC

设置 keySize

func (CipherCBC) WithNeedBmpPassword added in v1.0.2066

func (this CipherCBC) WithNeedBmpPassword(needBmpPass bool) CipherCBC

type CipherCCM

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

ccm 模式加密

func (CipherCCM) Decrypt

func (this CipherCCM) Decrypt(key, param, ciphertext []byte) ([]byte, error)

解密

func (CipherCCM) Encrypt

func (this CipherCCM) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherCCM) HasKeyLength added in v1.0.2039

func (this CipherCCM) HasKeyLength() bool

是否有 KeyLength

func (CipherCCM) KeySize

func (this CipherCCM) KeySize() int

值大小

func (CipherCCM) NeedBmpPassword added in v1.0.2066

func (this CipherCCM) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherCCM) OID

func (this CipherCCM) OID() asn1.ObjectIdentifier

oid

func (CipherCCM) WithHasKeyLength added in v1.0.2039

func (this CipherCCM) WithHasKeyLength(hasKeyLength bool) CipherCCM

func (CipherCCM) WithKeySize added in v1.0.2058

func (this CipherCCM) WithKeySize(keySize int) CipherCCM

设置 keySize

func (CipherCCM) WithNeedBmpPassword added in v1.0.2066

func (this CipherCCM) WithNeedBmpPassword(needBmpPass bool) CipherCCM

type CipherCCMIv added in v1.0.2029

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

ccm 模式加密

func (CipherCCMIv) Decrypt added in v1.0.2029

func (this CipherCCMIv) Decrypt(key, param, ciphertext []byte) ([]byte, error)

解密

func (CipherCCMIv) Encrypt added in v1.0.2029

func (this CipherCCMIv) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherCCMIv) HasKeyLength added in v1.0.2039

func (this CipherCCMIv) HasKeyLength() bool

是否有 KeyLength

func (CipherCCMIv) KeySize added in v1.0.2029

func (this CipherCCMIv) KeySize() int

值大小

func (CipherCCMIv) NeedBmpPassword added in v1.0.2066

func (this CipherCCMIv) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherCCMIv) OID added in v1.0.2029

func (this CipherCCMIv) OID() asn1.ObjectIdentifier

oid

func (CipherCCMIv) WithHasKeyLength added in v1.0.2039

func (this CipherCCMIv) WithHasKeyLength(hasKeyLength bool) CipherCCMIv

func (CipherCCMIv) WithKeySize added in v1.0.2058

func (this CipherCCMIv) WithKeySize(keySize int) CipherCCMIv

设置 keySize

func (CipherCCMIv) WithNeedBmpPassword added in v1.0.2066

func (this CipherCCMIv) WithNeedBmpPassword(needBmpPass bool) CipherCCMIv

type CipherCFB

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

CFB 模式加密

func (CipherCFB) Decrypt

func (this CipherCFB) Decrypt(key, params, ciphertext []byte) ([]byte, error)

解密

func (CipherCFB) Encrypt

func (this CipherCFB) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherCFB) HasKeyLength added in v1.0.2039

func (this CipherCFB) HasKeyLength() bool

是否有 KeyLength

func (CipherCFB) KeySize

func (this CipherCFB) KeySize() int

值大小

func (CipherCFB) NeedBmpPassword added in v1.0.2066

func (this CipherCFB) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherCFB) OID

func (this CipherCFB) OID() asn1.ObjectIdentifier

oid

func (CipherCFB) WithHasKeyLength added in v1.0.2039

func (this CipherCFB) WithHasKeyLength(hasKeyLength bool) CipherCFB

func (CipherCFB) WithKeySize added in v1.0.2058

func (this CipherCFB) WithKeySize(keySize int) CipherCFB

设置 keySize

func (CipherCFB) WithNeedBmpPassword added in v1.0.2066

func (this CipherCFB) WithNeedBmpPassword(needBmpPass bool) CipherCFB

type CipherCFB1

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

CFB1 模式加密

func (CipherCFB1) Decrypt

func (this CipherCFB1) Decrypt(key, params, ciphertext []byte) ([]byte, error)

解密

func (CipherCFB1) Encrypt

func (this CipherCFB1) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherCFB1) HasKeyLength added in v1.0.2039

func (this CipherCFB1) HasKeyLength() bool

是否有 KeyLength

func (CipherCFB1) KeySize

func (this CipherCFB1) KeySize() int

值大小

func (CipherCFB1) NeedBmpPassword added in v1.0.2066

func (this CipherCFB1) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherCFB1) OID

func (this CipherCFB1) OID() asn1.ObjectIdentifier

oid

func (CipherCFB1) WithHasKeyLength added in v1.0.2039

func (this CipherCFB1) WithHasKeyLength(hasKeyLength bool) CipherCFB1

func (CipherCFB1) WithKeySize added in v1.0.2058

func (this CipherCFB1) WithKeySize(keySize int) CipherCFB1

设置 keySize

func (CipherCFB1) WithNeedBmpPassword added in v1.0.2066

func (this CipherCFB1) WithNeedBmpPassword(needBmpPass bool) CipherCFB1

type CipherCFB8

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

CFB8 模式加密

func (CipherCFB8) Decrypt

func (this CipherCFB8) Decrypt(key, params, ciphertext []byte) ([]byte, error)

解密

func (CipherCFB8) Encrypt

func (this CipherCFB8) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherCFB8) HasKeyLength added in v1.0.2039

func (this CipherCFB8) HasKeyLength() bool

是否有 KeyLength

func (CipherCFB8) KeySize

func (this CipherCFB8) KeySize() int

值大小

func (CipherCFB8) NeedBmpPassword added in v1.0.2066

func (this CipherCFB8) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherCFB8) OID

func (this CipherCFB8) OID() asn1.ObjectIdentifier

oid

func (CipherCFB8) WithHasKeyLength added in v1.0.2039

func (this CipherCFB8) WithHasKeyLength(hasKeyLength bool) CipherCFB8

func (CipherCFB8) WithKeySize added in v1.0.2058

func (this CipherCFB8) WithKeySize(keySize int) CipherCFB8

设置 keySize

func (CipherCFB8) WithNeedBmpPassword added in v1.0.2066

func (this CipherCFB8) WithNeedBmpPassword(needBmpPass bool) CipherCFB8

type CipherCTR added in v1.0.2057

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

ctr 模式加密

func (CipherCTR) Decrypt added in v1.0.2057

func (this CipherCTR) Decrypt(key, params, ciphertext []byte) ([]byte, error)

解密

func (CipherCTR) Encrypt added in v1.0.2057

func (this CipherCTR) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherCTR) HasKeyLength added in v1.0.2057

func (this CipherCTR) HasKeyLength() bool

是否有 KeyLength

func (CipherCTR) KeySize added in v1.0.2057

func (this CipherCTR) KeySize() int

值大小

func (CipherCTR) NeedBmpPassword added in v1.0.2066

func (this CipherCTR) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherCTR) OID added in v1.0.2057

func (this CipherCTR) OID() asn1.ObjectIdentifier

oid

func (CipherCTR) WithHasKeyLength added in v1.0.2057

func (this CipherCTR) WithHasKeyLength(hasKeyLength bool) CipherCTR

func (CipherCTR) WithKeySize added in v1.0.2058

func (this CipherCTR) WithKeySize(keySize int) CipherCTR

设置 keySize

func (CipherCTR) WithNeedBmpPassword added in v1.0.2066

func (this CipherCTR) WithNeedBmpPassword(needBmpPass bool) CipherCTR

type CipherECB

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

ecb 模式加密

func (CipherECB) Decrypt

func (this CipherECB) Decrypt(key, params, ciphertext []byte) ([]byte, error)

解密

func (CipherECB) Encrypt

func (this CipherECB) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherECB) HasKeyLength added in v1.0.2039

func (this CipherECB) HasKeyLength() bool

是否有 KeyLength

func (CipherECB) KeySize

func (this CipherECB) KeySize() int

值大小

func (CipherECB) NeedBmpPassword added in v1.0.2066

func (this CipherECB) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherECB) OID

func (this CipherECB) OID() asn1.ObjectIdentifier

oid

func (CipherECB) WithHasKeyLength added in v1.0.2039

func (this CipherECB) WithHasKeyLength(hasKeyLength bool) CipherECB

func (CipherECB) WithKeySize added in v1.0.2058

func (this CipherECB) WithKeySize(keySize int) CipherECB

设置 keySize

func (CipherECB) WithNeedBmpPassword added in v1.0.2066

func (this CipherECB) WithNeedBmpPassword(needBmpPass bool) CipherECB

type CipherFunc added in v1.0.2032

type CipherFunc = func() Cipher

方法

type CipherGCM

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

gcm 模式加密

func (CipherGCM) Decrypt

func (this CipherGCM) Decrypt(key, param, ciphertext []byte) ([]byte, error)

解密

func (CipherGCM) Encrypt

func (this CipherGCM) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherGCM) HasKeyLength added in v1.0.2039

func (this CipherGCM) HasKeyLength() bool

是否有 KeyLength

func (CipherGCM) KeySize

func (this CipherGCM) KeySize() int

值大小

func (CipherGCM) NeedBmpPassword added in v1.0.2066

func (this CipherGCM) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherGCM) OID

func (this CipherGCM) OID() asn1.ObjectIdentifier

oid

func (CipherGCM) WithHasKeyLength added in v1.0.2039

func (this CipherGCM) WithHasKeyLength(hasKeyLength bool) CipherGCM

func (CipherGCM) WithKeySize added in v1.0.2058

func (this CipherGCM) WithKeySize(keySize int) CipherGCM

设置 keySize

func (CipherGCM) WithNeedBmpPassword added in v1.0.2066

func (this CipherGCM) WithNeedBmpPassword(needBmpPass bool) CipherGCM

type CipherGCMIv added in v1.0.2029

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

gcm 模式加密

func (CipherGCMIv) Decrypt added in v1.0.2029

func (this CipherGCMIv) Decrypt(key, param, ciphertext []byte) ([]byte, error)

解密

func (CipherGCMIv) Encrypt added in v1.0.2029

func (this CipherGCMIv) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherGCMIv) HasKeyLength added in v1.0.2039

func (this CipherGCMIv) HasKeyLength() bool

是否有 KeyLength

func (CipherGCMIv) KeySize added in v1.0.2029

func (this CipherGCMIv) KeySize() int

值大小

func (CipherGCMIv) NeedBmpPassword added in v1.0.2066

func (this CipherGCMIv) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherGCMIv) OID added in v1.0.2029

func (this CipherGCMIv) OID() asn1.ObjectIdentifier

oid

func (CipherGCMIv) WithHasKeyLength added in v1.0.2039

func (this CipherGCMIv) WithHasKeyLength(hasKeyLength bool) CipherGCMIv

func (CipherGCMIv) WithKeySize added in v1.0.2058

func (this CipherGCMIv) WithKeySize(keySize int) CipherGCMIv

设置 keySize

func (CipherGCMIv) WithNeedBmpPassword added in v1.0.2066

func (this CipherGCMIv) WithNeedBmpPassword(needBmpPass bool) CipherGCMIv

type CipherGostCFB added in v1.0.2050

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

Gost CFB 模式加密

func (CipherGostCFB) Decrypt added in v1.0.2050

func (this CipherGostCFB) Decrypt(key, params, ciphertext []byte) ([]byte, error)

解密

func (CipherGostCFB) Encrypt added in v1.0.2050

func (this CipherGostCFB) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherGostCFB) HasKeyLength added in v1.0.2050

func (this CipherGostCFB) HasKeyLength() bool

是否有 KeyLength

func (CipherGostCFB) KeySize added in v1.0.2050

func (this CipherGostCFB) KeySize() int

值大小

func (CipherGostCFB) NeedBmpPassword added in v1.0.2066

func (this CipherGostCFB) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherGostCFB) OID added in v1.0.2050

func (this CipherGostCFB) OID() asn1.ObjectIdentifier

oid

func (CipherGostCFB) WithHasKeyLength added in v1.0.2050

func (this CipherGostCFB) WithHasKeyLength(hasKeyLength bool) CipherGostCFB

func (CipherGostCFB) WithKeySize added in v1.0.2058

func (this CipherGostCFB) WithKeySize(keySize int) CipherGostCFB

设置 keySize

func (CipherGostCFB) WithNeedBmpPassword added in v1.0.2066

func (this CipherGostCFB) WithNeedBmpPassword(needBmpPass bool) CipherGostCFB

func (CipherGostCFB) WithSbox added in v1.0.2050

func (this CipherGostCFB) WithSbox(name string) CipherGostCFB

type CipherOFB

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

OFB 模式加密

func (CipherOFB) Decrypt

func (this CipherOFB) Decrypt(key, params, ciphertext []byte) ([]byte, error)

解密

func (CipherOFB) Encrypt

func (this CipherOFB) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherOFB) HasKeyLength added in v1.0.2039

func (this CipherOFB) HasKeyLength() bool

是否有 KeyLength

func (CipherOFB) KeySize

func (this CipherOFB) KeySize() int

值大小

func (CipherOFB) NeedBmpPassword added in v1.0.2066

func (this CipherOFB) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherOFB) OID

func (this CipherOFB) OID() asn1.ObjectIdentifier

oid

func (CipherOFB) WithHasKeyLength added in v1.0.2039

func (this CipherOFB) WithHasKeyLength(hasKeyLength bool) CipherOFB

func (CipherOFB) WithKeySize added in v1.0.2058

func (this CipherOFB) WithKeySize(keySize int) CipherOFB

设置 keySize

func (CipherOFB) WithNeedBmpPassword added in v1.0.2066

func (this CipherOFB) WithNeedBmpPassword(needBmpPass bool) CipherOFB

type CipherRC2CBC

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

cbc 模式加密

func (CipherRC2CBC) Decrypt

func (this CipherRC2CBC) Decrypt(key, params, ciphertext []byte) ([]byte, error)

解密

func (CipherRC2CBC) Encrypt

func (this CipherRC2CBC) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherRC2CBC) HasKeyLength added in v1.0.2039

func (this CipherRC2CBC) HasKeyLength() bool

是否有 KeyLength

func (CipherRC2CBC) KeySize

func (this CipherRC2CBC) KeySize() int

值大小

func (CipherRC2CBC) NeedBmpPassword added in v1.0.2066

func (this CipherRC2CBC) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherRC2CBC) OID

func (this CipherRC2CBC) OID() asn1.ObjectIdentifier

oid

func (CipherRC2CBC) WithHasKeyLength added in v1.0.2039

func (this CipherRC2CBC) WithHasKeyLength(hasKeyLength bool) CipherRC2CBC

func (CipherRC2CBC) WithKeySize

func (this CipherRC2CBC) WithKeySize(keySize int) CipherRC2CBC

设置 keySize

func (CipherRC2CBC) WithNeedBmpPassword added in v1.0.2066

func (this CipherRC2CBC) WithNeedBmpPassword(needBmpPass bool) CipherRC2CBC

func (CipherRC2CBC) WithRC2Version

func (this CipherRC2CBC) WithRC2Version(rc2Version int) CipherRC2CBC

设置 RC2Version

type CipherRC5CBC

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

cbc 模式加密

func (CipherRC5CBC) Decrypt

func (this CipherRC5CBC) Decrypt(key, params, ciphertext []byte) ([]byte, error)

解密

func (CipherRC5CBC) Encrypt

func (this CipherRC5CBC) Encrypt(rand io.Reader, key, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherRC5CBC) HasKeyLength added in v1.0.2039

func (this CipherRC5CBC) HasKeyLength() bool

是否有 KeyLength

func (CipherRC5CBC) KeySize

func (this CipherRC5CBC) KeySize() int

值大小

func (CipherRC5CBC) NeedBmpPassword added in v1.0.2066

func (this CipherRC5CBC) NeedBmpPassword() bool

密码是否需要 Bmp 处理

func (CipherRC5CBC) OID

func (this CipherRC5CBC) OID() asn1.ObjectIdentifier

oid

func (CipherRC5CBC) WithHasKeyLength added in v1.0.2039

func (this CipherRC5CBC) WithHasKeyLength(hasKeyLength bool) CipherRC5CBC

func (CipherRC5CBC) WithKeySize

func (this CipherRC5CBC) WithKeySize(keySize int) CipherRC5CBC

设置 keySize

func (CipherRC5CBC) WithNeedBmpPassword added in v1.0.2066

func (this CipherRC5CBC) WithNeedBmpPassword(needBmpPass bool) CipherRC5CBC

func (CipherRC5CBC) WithRounds

func (this CipherRC5CBC) WithRounds(rounds uint) CipherRC5CBC

设置 Rounds

func (CipherRC5CBC) WithWordSize

func (this CipherRC5CBC) WithWordSize(wordSize uint) CipherRC5CBC

设置 WordSize

type Ciphers added in v1.0.2032

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

Ciphers

func CloneCiphers added in v1.0.2032

func CloneCiphers() *Ciphers

克隆

func NewCiphers added in v1.0.2032

func NewCiphers() *Ciphers

func (*Ciphers) AddCipher added in v1.0.2032

func (this *Ciphers) AddCipher(oid asn1.ObjectIdentifier, cipher CipherFunc)

添加加密

func (*Ciphers) All added in v1.0.2032

func (this *Ciphers) All() map[string]CipherFunc

全部

func (*Ciphers) Clone added in v1.0.2032

func (this *Ciphers) Clone() *Ciphers

克隆

func (*Ciphers) GetCipher added in v1.0.2032

func (this *Ciphers) GetCipher(alg any) (Cipher, error)

获取加密

type GostSbox added in v1.0.2050

type GostSbox struct {
	OID  asn1.ObjectIdentifier
	Sbox [][]byte
}

func GetGostSbox added in v1.0.2050

func GetGostSbox(name string) (GostSbox, bool)

Jump to

Keyboard shortcuts

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