Hello Berin,

        Yes, patch solves first problem. Thank you. Do you have any idea
what could be solution for second problem?

Best regards,
Milan


> -----Original Message-----
> From: Berin Lautenbach [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, October 02, 2004 2:31 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [java & c++] interoperability & encryption
> 
> 
> Matej/Milan,
> 
> There appears to be two separate problems.  The first (cpp 
> encrypt->java 
> decrypt) is the one Matej indicated - the RSA encryption within the 
> windows crypto API stores the bytes in reverse order.  I have 
> pasted a 
> diff against WinCapiCryptoKeyRSA.cpp that will fix that problem.
> 
> The second problem (java->cpp) is proving harder to find.  I 
> find that I 
> cannot decrypt your Java using OpenSSL as the provider either 
> - which is 
> strange.  So I'm going to have a play with the Java library 
> and see if I 
> can work out what it is.
> 
> Can you verify whether the patch below fixes the cpp->java problem?
> 
> Cheers,       
>       Berin
> 
> cvs -z3 diff WinCAPICryptoKeyRSA.cpp (in directory 
> C:\prog\SRC\xml-security\c\src\enc\WinCAPI\)
> Index: WinCAPICryptoKeyRSA.cpp 
> ===================================================================
> RCS file: 
> /home/cvs/xml-security/c/src/enc/WinCAPI/WinCAPICryptoKeyRSA.cpp,v
> retrieving revision 1.7
> diff -r1.7 WinCAPICryptoKeyRSA.cpp
> 507a508
>  >    // Have to reverse ordering of input :
> 509c510,512
> <     memcpy(plainBuf, inBuf, inLength);
> ---
>  >    // memcpy(plainBuf, inBuf, inLength);
>  >    for (unsigned int i = 0; i < inLength; ++i)
>  >            plainBuf[i] = inBuf[inLength - 1 - i];
> 633a637,644
>  >    // Reverse the output
>  >    unsigned char *tbuf;
>  >    XSECnew(tbuf, unsigned char[encryptSize]);
>  >    ArrayJanitor<unsigned char> j_tbuf(tbuf);
>  >    memcpy(tbuf, cipherBuf, encryptSize);
>  >
>  >    for (unsigned int i = 0; i < encryptSize; ++i)
>  >            cipherBuf[i] = tbuf[encryptSize - 1 - i];
> 
> 
> 


Reply via email to