(password string, rsaPrivateKey string)
| 155 | } |
| 156 | |
| 157 | func DecryptPassword(password string, rsaPrivateKey string) (realPwd string, err error) { |
| 158 | if "" == rsaPrivateKey { |
| 159 | return "", fmt.Errorf("rsa private key should not be empty") |
| 160 | } |
| 161 | |
| 162 | realPwdByte := []byte{} |
| 163 | realPwdByte, err = base64.StdEncoding.DecodeString(password) |
| 164 | if err != nil { |
| 165 | return "", err |
| 166 | } |
| 167 | |
| 168 | realPwdByte, err = rsaDecrypt(realPwdByte, rsaPrivateKey) |
| 169 | if err != nil { |
| 170 | return "", err |
| 171 | } |
| 172 | realPwd = string(realPwdByte) |
| 173 | return realPwd, nil |
| 174 | } |
| 175 | |
| 176 | func IsEmpty(value interface{}) bool { |
| 177 | switch value.(type) { |
no test coverage detected