MCPcopy Create free account
hub / github.com/actiontech/dtle / rsaDecrypt

Function rsaDecrypt

api/handler/common.go:138–148  ·  view source on GitHub ↗
(ciphertext []byte, privateKey string)

Source from the content-addressed store, hash-verified

136}
137
138func rsaDecrypt(ciphertext []byte, privateKey string) ([]byte, error) {
139 block, _ := pem.Decode([]byte(privateKey))
140 if block == nil {
141 return nil, fmt.Errorf("private key error!")
142 }
143 priv, err := x509.ParsePKCS1PrivateKey(block.Bytes)
144 if err != nil {
145 return nil, fmt.Errorf(fmt.Sprintf("Parse private key error:%s", err))
146 }
147 return rsa.DecryptPKCS1v15(rand.Reader, priv, ciphertext)
148}
149
150func DecryptPasswordSupportNoRsaKey(password string, rsaPrivateKey string) (realPwd string, err error) {
151 if "" == rsaPrivateKey {

Callers 1

DecryptPasswordFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected