Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed May 6, 2023
1 parent 681dc8d commit d7f3708
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
2 changes: 1 addition & 1 deletion app/example/controller/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func (this *Data) Error(ctx *gin.Context) {
bksErrData = bksErr.Error()
}

key.ShowBerP12_2()
// key.ShowBerP12()
// key.MakePKCS12_2()

// 事件
Expand Down
20 changes: 0 additions & 20 deletions app/example/key/key_pkcs12.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
pkcs7_ber "github.com/deatil/go-cryptobin/pkcs7/ber"
cryptobin_rsa "github.com/deatil/go-cryptobin/cryptobin/rsa"
cryptobin_pkcs12 "github.com/deatil/go-cryptobin/pkcs12"
cryptobin_pkcs12ber "github.com/deatil/go-cryptobin/pkcs12ber"
)

type Errs struct{
Expand Down Expand Up @@ -631,22 +630,3 @@ func ShowBerP12() {
fmt.Println("")
}

func ShowBerP12_2() {
fs := filesystem.New()
p12, _ := fs.Get("./runtime/p12/testSM20210913-12345678.pfx")

priv, cert, err := cryptobin_pkcs12ber.Decode([]byte(p12), "12345678")
if err != nil {
fmt.Println("err =====")
fmt.Println(err.Error())
fmt.Println("")
}

fmt.Println("cert =====")
fmt.Printf("%#v", cert)
fmt.Println("")

fmt.Println("priv =====")
fmt.Printf("%#v", priv)
fmt.Println("")
}
17 changes: 9 additions & 8 deletions pkg/lakego-pkg/go-cryptobin/pkcs8pbe/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ package pkcs8pbe

// PEMCipher 列表
var PEMCipherMap = map[string]PEMCipher{
"MD2AndDES": PEMCipherMD2AndDES,
"MD5AndDES": PEMCipherMD5AndDES,
"SHA1AndDES": PEMCipherSHA1AndDES,
"SHA1And2DES": PEMCipherSHA1And2DES,
// pcks12 模式
"SHA1And3DES": PEMCipherSHA1And3DES,

"SHA1And2DES": PEMCipherSHA1And2DES,
"SHA1AndRC2_128": PEMCipherSHA1AndRC2_128,
"SHA1AndRC2_40": PEMCipherSHA1AndRC2_40,
"SHA1AndRC4_128": PEMCipherSHA1AndRC4_128,
"SHA1AndRC4_40": PEMCipherSHA1AndRC4_40,

"SHA1AndRC2_40": PEMCipherSHA1AndRC2_40,
"SHA1AndRC2_64": PEMCipherSHA1AndRC2_64,
"SHA1AndRC2_128": PEMCipherSHA1AndRC2_128,
// pkcs5-v1.5 模式
"MD2AndDES": PEMCipherMD2AndDES,
"MD2AndRC2_64": PEMCipherMD2AndRC2_64,
"MD5AndDES": PEMCipherMD5AndDES,
"MD5AndRC2_64": PEMCipherMD5AndRC2_64,
"SHA1AndDES": PEMCipherSHA1AndDES,
"SHA1AndRC2_64": PEMCipherSHA1AndRC2_64,
}

// 获取 Cipher 类型
Expand Down

0 comments on commit d7f3708

Please sign in to comment.