Decrypt the RSA private key PKCS1 formatted private key, which is described by the ASN.1 type: RSAPrivateKey ::= SEQUENCE { version Version, modulus INTEGER, -- n publicExponent INTEGER, -- e privateExponent INTEGER, -- d
(encrypted_private_key, data_key)
| 157 | |
| 158 | |
| 159 | def decrypt_rsa_key(encrypted_private_key, data_key): |
| 160 | """ Decrypt the RSA private key |
| 161 | PKCS1 formatted private key, which is described by the ASN.1 type: |
| 162 | RSAPrivateKey ::= SEQUENCE { |
| 163 | version Version, |
| 164 | modulus INTEGER, -- n |
| 165 | publicExponent INTEGER, -- e |
| 166 | privateExponent INTEGER, -- d |
| 167 | prime1 INTEGER, -- p |
| 168 | prime2 INTEGER, -- q |
| 169 | exponent1 INTEGER, -- d mod (p-1) |
| 170 | exponent2 INTEGER, -- d mod (q-1) |
| 171 | coefficient INTEGER, -- (inverse of q) mod p |
| 172 | otherPrimeInfos OtherPrimeInfos OPTIONAL |
| 173 | } |
| 174 | """ |
| 175 | decoded_data = utils.base64_url_decode(encrypted_private_key) |
| 176 | return RSA.importKey(crypto.decrypt_aes_v1(decoded_data, data_key)) |
| 177 | |
| 178 | |
| 179 | def get_record(params, record_uid): |
nothing calls this directly
no outgoing calls
no test coverage detected