pbes1

package
v1.0.2023 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MD2AndDES = CipherBlockCBC{
	// contains filtered or unexported fields
}

pkcs5-v1.5 模式

View Source
var MD2AndRC2_64 = CipherBlockCBC{
	// contains filtered or unexported fields
}
View Source
var MD5AndDES = CipherBlockCBC{
	// contains filtered or unexported fields
}
View Source
var MD5AndRC2_64 = CipherBlockCBC{
	// contains filtered or unexported fields
}
View Source
var PEMCipherMap = map[string]Cipher{

	"SHA1And3DES":    SHA1And3DES,
	"SHA1And2DES":    SHA1And2DES,
	"SHA1AndRC2_128": SHA1AndRC2_128,
	"SHA1AndRC2_40":  SHA1AndRC2_40,
	"SHA1AndRC4_128": SHA1AndRC4_128,
	"SHA1AndRC4_40":  SHA1AndRC4_40,

	"MD2AndDES":     MD2AndDES,
	"MD2AndRC2_64":  MD2AndRC2_64,
	"MD5AndDES":     MD5AndDES,
	"MD5AndRC2_64":  MD5AndRC2_64,
	"SHA1AndDES":    SHA1AndDES,
	"SHA1AndRC2_64": SHA1AndRC2_64,
}

PEMCipher 列表

View Source
var SHA1And2DES = CipherBlockCBC{
	// contains filtered or unexported fields
}
View Source
var SHA1And3DES = CipherBlockCBC{
	// contains filtered or unexported fields
}

pkcs12 模式

View Source
var SHA1AndDES = CipherBlockCBC{
	// contains filtered or unexported fields
}
View Source
var SHA1AndRC2_128 = CipherBlockCBC{
	// contains filtered or unexported fields
}
View Source
var SHA1AndRC2_40 = CipherBlockCBC{
	// contains filtered or unexported fields
}
View Source
var SHA1AndRC2_64 = CipherBlockCBC{
	// contains filtered or unexported fields
}
View Source
var SHA1AndRC4_128 = CipherRC4{
	// contains filtered or unexported fields
}
View Source
var SHA1AndRC4_40 = CipherRC4{
	// contains filtered or unexported fields
}

Functions

func AddCipher

func AddCipher(oid asn1.ObjectIdentifier, cipher func() Cipher)

添加加密

func CheckCipherFromName

func CheckCipherFromName(name string) bool

检测 Cipher 类型

Types

type Cipher

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

	// 值大小
	KeySize() int

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

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

加密接口

func GetCipher

func GetCipher(oid string) (Cipher, error)

获取加密

func GetCipherFromName

func GetCipherFromName(name string) Cipher

获取 Cipher 类型

type CipherBlockCBC

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

cbc 模式加密

func (CipherBlockCBC) Decrypt

func (this CipherBlockCBC) Decrypt(password, params, ciphertext []byte) ([]byte, error)

解密

func (CipherBlockCBC) Encrypt

func (this CipherBlockCBC) Encrypt(password, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherBlockCBC) KeySize

func (this CipherBlockCBC) KeySize() int

值大小

func (CipherBlockCBC) OID

oid

func (CipherBlockCBC) WithSaltSize

func (this CipherBlockCBC) WithSaltSize(saltSize int) CipherBlockCBC

设置 saltSize

type CipherRC4

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

rc4 模式加密

func (CipherRC4) Decrypt

func (this CipherRC4) Decrypt(password, params, ciphertext []byte) ([]byte, error)

解密

func (CipherRC4) Encrypt

func (this CipherRC4) Encrypt(password, plaintext []byte) ([]byte, []byte, error)

加密

func (CipherRC4) KeySize

func (this CipherRC4) KeySize() int

值大小

func (CipherRC4) OID

func (this CipherRC4) OID() asn1.ObjectIdentifier

oid

func (CipherRC4) WithSaltSize

func (this CipherRC4) WithSaltSize(saltSize int) CipherRC4

设置 saltSize

Jump to

Keyboard shortcuts

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