Re: Encrypting RSA private key with passphrase
"'Bobbel888' via Crypto++ Users" <[email protected]> Sat, 4 Jan 2025 07:04:27 -0800 (PST)
| Newsgroups | gmane.comp.encryption.cryptopp |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_923290_1187732352.1736003067842 Content-Type: multipart/alternative; boundary="----=_Part_923291_1174987079.1736003067842" ------=_Part_923291_1174987079.1736003067842 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable The normal answer is PKCS#12 <https://en.wikipedia.org/wiki/PKCS_12>,=20 Crypto++ -reference should be here =20 https://www.cryptopp.com/docs/ref/class_p_k_c_s12___p_b_k_d_f.html ELSE *From a generic approach for file encryption:* You take the DER of some RSA-key and encrypt it with some symmetric=20 algorithm,=20 e.g. AES-CBC with authentication, e.g. CMAC or HMAC,=20 or a Block-Cipher with conceptually built-in authentitation, e.g.=20 AES-GCM, AES-CCM The secret key pair (key,iv) is derived by PBKDF2 from static (password,=20 salt). Authentication is recommended to assert that the file has not been=20 corrupted. Authenticators CMAC or HMAC require another pre-shared key; here the static pre-shared parameters are (password, KFD-salt,=20 Authenticator-key)=20 After decision about the actual algorithms, you should be able to realize= =20 the steps=20 from Crypto++ examples, which are currently found at web.archive.org --> www.cryptopp.com=20 <https://web.archive.org/web/20240000000000*/www.cryptopp.com> Jeffrey Walton schrieb am Donnerstag, 16. November 2023 um 16:49:18 UTC+1: > On Thursday, November 16, 2023 at 10:46:17=E2=80=AFAM UTC-5 cl.rob...@gma= il.com=20 > wrote: > > Humm almost 20 years later and I have the same question. And the FAQ does= =20 > not have the answer. > > =20 > Yeah, the FAQ is kind of old. Use the wiki now: < > https://www.cryptopp.com/wiki/Main_Page>. > > Actually, my case is a little bit more specific. I need to unlock a=20 > private key that was locked somewhere else, using openSSL. The key usage = is=20 > for decrypting and unwrapping.=20 > > > Try <https://www.cryptopp.com/wiki/PEM_Pack>. > > Jeff > --=20 You received this message because you are subscribed to the Google Groups "= Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/cryptopp-us= ers/72a63e16-d27f-41a9-be92-665b32806c30n%40googlegroups.com. ------=_Part_923291_1174987079.1736003067842 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div>The normal answer is <a href=3D"https://en.wikipedia.org/wiki/PKCS_12"= >PKCS#12</a>,=C2=A0</div><div>Crypto++ -reference should be here=C2=A0 http= s://www.cryptopp.com/docs/ref/class_p_k_c_s12___p_b_k_d_f.html</div><div><b= r /></div><div>ELSE<br /></div><div><br /></div><div><b>From a generic appr= oach for file encryption:</b></div><div><br /></div><div>You take the DER o= f some RSA-key and encrypt it with some symmetric algorithm,=C2=A0</div><di= v>e.g. AES-CBC with authentication, e.g. CMAC or HMAC,=C2=A0</div><div>=C2= =A0=C2=A0 or a Block-Cipher with conceptually built-in authentitation, e.g.= AES-GCM, AES-CCM<br /></div><div>The secret key pair (key,iv) is derived b= y PBKDF2 from static (password, salt).</div><br />Authentication is recomme= nded to assert that the file has not been corrupted.<br /> Authenticators CMAC or HMAC require another pre-shared key; here<br /><div>= the static pre-shared parameters=20 are (password, KFD-salt, Authenticator-key) <br /></div><div><br /></div><d= iv>After decision about the actual algorithms, you should be able to realiz= e the steps=C2=A0</div><div>from Crypto++ examples,=C2=A0 which are current= ly found at</div><div><a href=3D"https://web.archive.org/web/20240000000000= */www.cryptopp.com">web.archive.org --> www.cryptopp.com</a><br /><br />= </div><div class=3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_attr">Jef= frey Walton schrieb am Donnerstag, 16. November 2023 um 16:49:18 UTC+1:<br/= ></div><blockquote class=3D"gmail_quote" style=3D"margin: 0 0 0 0.8ex; bord= er-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div dir=3D= "auto">On Thursday, November 16, 2023 at 10:46:17=E2=80=AFAM UTC-5 <a href = data-email-masked rel=3D"nofollow">[email protected]</a> wrote:<br></div>= <blockquote style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204= ,204,204);padding-left:1ex"><div>Humm almost 20 years later and I have the = same question. And the FAQ does not have the answer.<br></div></blockquote>= <div>=C2=A0</div></div><div><div>Yeah, the FAQ is kind of old. Use the wiki= now: <<a href=3D"https://www.cryptopp.com/wiki/Main_Page" target=3D"_bl= ank" rel=3D"nofollow" data-saferedirecturl=3D"https://www.google.com/url?hl= =3Dde&q=3Dhttps://www.cryptopp.com/wiki/Main_Page&source=3Dgmail&am= p;ust=3D1736084724702000&usg=3DAOvVaw3wZForU-7RvZbQ30KaqrXZ">https://ww= w.cryptopp.com/wiki/Main_Page</a>>.</div></div><div><div><br></div><bloc= kquote style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,= 204);padding-left:1ex"><div></div><div>Actually, my case is a little bit mo= re specific. I need to unlock a private key that was locked somewhere else,= using openSSL. The key usage is for decrypting and unwrapping. <br></div><= /blockquote><div><br></div></div><div><div>Try <<a href=3D"https://www.c= ryptopp.com/wiki/PEM_Pack" target=3D"_blank" rel=3D"nofollow" data-saferedi= recturl=3D"https://www.google.com/url?hl=3Dde&q=3Dhttps://www.cryptopp.= com/wiki/PEM_Pack&source=3Dgmail&ust=3D1736084724702000&usg=3DA= OvVaw2bN-8eAwLgBQuYHU0tKskX">https://www.cryptopp.com/wiki/PEM_Pack</a>>= .</div><div><br></div><div>Jeff<br> </div></div></blockquote></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;Crypto++ Users" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">cryp= [email protected]</a>.<br /> To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/= cryptopp-users/72a63e16-d27f-41a9-be92-665b32806c30n%40googlegroups.com?utm= _medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/cryp= topp-users/72a63e16-d27f-41a9-be92-665b32806c30n%40googlegroups.com</a>.<br= /> ------=_Part_923291_1174987079.1736003067842-- ------=_Part_923290_1187732352.1736003067842--