Delphi-OpenSSL icon indicating copy to clipboard operation
Delphi-OpenSSL copied to clipboard

AES256 Decrypt with PrivateKey (Certificate)

Open jindrichvolek opened this issue 6 years ago • 3 comments

Hello please, how to decrypt AES256 with PrivateKey (Certificate) Thx.

jindrichvolek avatar Jan 18 '20 22:01 jindrichvolek

You can see the code here: https://github.com/lminuti/Delphi-OpenSSL#encrypt-with-aes256 But AES256 is a symmetric algorithm, it uses a key and an initialization vector to encode the data not a certificate. DelphiOpenSSL has a special record (TPassphrase) that can generate key and IV from a string.

lminuti avatar Jan 20 '20 08:01 lminuti

Hello thx for answer. I receive some encrypted data from goverment institution. As descripted - they are encrypted aes256 with public qualified certificate: <Data contentEncoding="base64" compression="gzip" encryptionAlgorithm="aes256">UZI5445..............</Data> and I don’t know, how it decrypted... J.Volek From: Luca Minuti Sent: Monday, January 20, 2020 9:10 AM To: lminuti/Delphi-OpenSSL Cc: jindrichvolek ; Author Subject: Re: [lminuti/Delphi-OpenSSL] AES256 Decrypt with PrivateKey (Certificate) (#5)

You can see the code here: https://github.com/lminuti/Delphi-OpenSSL#encrypt-with-aes256 But AES256 is a symmetric algorithm, it uses a key and an initialization vector to encode the data not a certificate. DelphiOpenSSL has a special record (TPassphrase) that can generate key and IV from a string.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

jindrichvolek avatar Jan 26 '20 08:01 jindrichvolek

I'm sorry but I never use AES with certificate. You can try to inspect the certificate with something like: openssl x509 -in your_cerificate -text and try to extract the key.

lminuti avatar Jan 27 '20 08:01 lminuti