[PATCH v2 2/2] crypt32: Add support for importing RSA public keys with BCrypt.

Hans Leidekker hans at codeweavers.com
Mon Apr 12 07:03:44 CDT 2021


On Mon, 2021-04-12 at 14:34 +0300, Dmitry Timoshkov wrote:
> Dmitry Timoshkov <dmitry at baikal.ru> wrote:
> 
> > Hans Leidekker <hans at codeweavers.com> wrote:
> > 
> > > On Mon, 2021-04-12 at 12:48 +0300, Dmitry Timoshkov wrote:
> > > > v2:
> > > > - Fixed calculation of cbPublicExp and cbModulus.
> > > > - pass PublicExp in BE format to follow MSDN.
> > > 
> > > Should the modulus also be converted to BE format?
> > 
> > I'm not sure, though MSDN claims that the modulus provided by PUBLICKEYBLOB is
> > also in LE format:
> > https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-mqqb/ade9efde-3ec8-4e47-9ae9-34b64d8081bb
> > 
> > I'd guess that gnutls verifies the modulus during the key creation.
> > If the modulus also should be converted, taking into account that its
> > length is variable, how would you propose to handle the conversion?
> 
> Taking into account that the modulus goes straight from the certificate
> data, I'd guess that the conversion is not needed.

You get a PUBLICKEYBLOB which is little-endian, so you do need to
convert. You have calculated cbModulus already, so you can just replace
the memcpy with a loop that stores the bytes in reverse order.





More information about the wine-devel mailing list