pkcs8

package
v1.0.2034 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// pkcs12
	SHA1And3DES    = pbes1.SHA1And3DES
	SHA1And2DES    = pbes1.SHA1And2DES
	SHA1AndRC2_128 = pbes1.SHA1AndRC2_128
	SHA1AndRC2_40  = pbes1.SHA1AndRC2_40
	SHA1AndRC4_128 = pbes1.SHA1AndRC4_128
	SHA1AndRC4_40  = pbes1.SHA1AndRC4_40

	// PBES1
	MD2AndDES     = pbes1.MD2AndDES
	MD2AndRC2_64  = pbes1.MD2AndRC2_64
	MD5AndDES     = pbes1.MD5AndDES
	MD5AndRC2_64  = pbes1.MD5AndRC2_64
	SHA1AndDES    = pbes1.SHA1AndDES
	SHA1AndRC2_64 = pbes1.SHA1AndRC2_64

	// pkcs8 模式
	DESCBC     = pbes2.DESCBC
	DESEDE3CBC = pbes2.DESEDE3CBC

	RC2CBC     = pbes2.RC2CBC
	RC2_40CBC  = pbes2.RC2_40CBC
	RC2_64CBC  = pbes2.RC2_64CBC
	RC2_128CBC = pbes2.RC2_128CBC

	RC5CBC     = pbes2.RC5CBC
	RC5_128CBC = pbes2.RC5_128CBC
	RC5_192CBC = pbes2.RC5_192CBC
	RC5_256CBC = pbes2.RC5_256CBC

	AES128ECB = pbes2.AES128ECB
	AES128CBC = pbes2.AES128CBC
	AES128OFB = pbes2.AES128OFB
	AES128CFB = pbes2.AES128CFB
	AES128GCM = pbes2.AES128GCM
	AES128CCM = pbes2.AES128CCM

	AES192ECB = pbes2.AES192ECB
	AES192CBC = pbes2.AES192CBC
	AES192OFB = pbes2.AES192OFB
	AES192CFB = pbes2.AES192CFB
	AES192GCM = pbes2.AES192GCM
	AES192CCM = pbes2.AES192CCM

	AES256ECB = pbes2.AES256ECB
	AES256CBC = pbes2.AES256CBC
	AES256OFB = pbes2.AES256OFB
	AES256CFB = pbes2.AES256CFB
	AES256GCM = pbes2.AES256GCM
	AES256CCM = pbes2.AES256CCM

	SM4ECB  = pbes2.SM4ECB
	SM4CBC  = pbes2.SM4CBC
	SM4OFB  = pbes2.SM4OFB
	SM4CFB  = pbes2.SM4CFB
	SM4CFB1 = pbes2.SM4CFB1
	SM4CFB8 = pbes2.SM4CFB8
	SM4GCM  = pbes2.SM4GCM
	SM4CCM  = pbes2.SM4CCM
)

加密方式

View Source
var (
	// 获取 Cipher 类型
	GetCipherFromName = cryptobin_pbes2.GetCipherFromName
	// 获取 hash 类型
	GetHashFromName = cryptobin_pbes2.GetHashFromName
)

默认配置

默认配置 PBKDF2

View Source
var DefaultPBKDF2OptsWithKeyLength = cryptobin_pbes2.DefaultPBKDF2OptsWithKeyLength

默认配置 PBKDF2,带 key 长度

默认配置 Scrypt

Functions

func DecryptPEMBlock

func DecryptPEMBlock(block *pem.Block, password []byte) ([]byte, error)

解密 de, err := DecryptPEMBlock(block, password)

func EncryptPEMBlock added in v1.0.2029

func EncryptPEMBlock(
	rand io.Reader,
	blockType string,
	data []byte,
	password []byte,
	cipher any,
) (*pem.Block, error)

加密 block, err := EncryptPEMBlock(rand.Reader, "ENCRYPTED PRIVATE KEY", data, password, DESCBC) block, err := EncryptPEMBlock(rand.Reader, "ENCRYPTED PRIVATE KEY", data, password, DefaultOpts)

func ParseOpts added in v1.0.1020

func ParseOpts(opts ...any) (any, error)

解析设置 opt, err := ParseOpts("AES256CBC", "SHA256") block, err := EncryptPEMBlock(rand.Reader, "ENCRYPTED PRIVATE KEY", data, password, opt)

Types

type Opts

type Opts = cryptobin_pbes2.Opts

配置

type PBKDF2Opts added in v1.0.1018

type PBKDF2Opts = cryptobin_pbes2.PBKDF2Opts

type PBKDF2OptsWithKeyLength added in v1.0.1033

type PBKDF2OptsWithKeyLength = cryptobin_pbes2.PBKDF2OptsWithKeyLength

type ScryptOpts added in v1.0.1018

type ScryptOpts = cryptobin_pbes2.ScryptOpts

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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