(encryptedKey *etree.Element)
| 94 | } |
| 95 | |
| 96 | func getCiphertext(encryptedKey *etree.Element) ([]byte, error) { |
| 97 | ciphertextEl := encryptedKey.FindElement("./CipherData/CipherValue") |
| 98 | if ciphertextEl == nil { |
| 99 | return nil, fmt.Errorf("cannot find CipherData element containing a CipherValue element") |
| 100 | } |
| 101 | ciphertext, err := base64.StdEncoding.DecodeString(strings.TrimSpace(ciphertextEl.Text())) |
| 102 | if err != nil { |
| 103 | return nil, err |
| 104 | } |
| 105 | return ciphertext, nil |
| 106 | } |
| 107 | |
| 108 | func validateRSAKeyIfPresent(key interface{}, encryptedKey *etree.Element) (*rsa.PrivateKey, error) { |
| 109 | rsaKey, ok := key.(*rsa.PrivateKey) |
no outgoing calls