Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #1535 > unrolled thread
| Started by | Trevor <trevor@holyoak.com> |
|---|---|
| First post | 2011-05-11 15:03 -0600 |
| Last post | 2011-05-17 11:38 -0600 |
| Articles | 5 — 4 participants |
Back to article view | Back to comp.lang.php
Encrypt/decrypt compatibility with Microsoft Crypto API? Trevor <trevor@holyoak.com> - 2011-05-11 15:03 -0600
Re: Encrypt/decrypt compatibility with Microsoft Crypto API? JohnT <john@example.com> - 2011-05-11 22:15 +0000
Re: Encrypt/decrypt compatibility with Microsoft Crypto API? Trevor <trevorREMOVE@holyoak.com> - 2011-05-13 16:20 -0600
Re: Encrypt/decrypt compatibility with Microsoft Crypto API? The Natural Philosopher <tnp@invalid.invalid> - 2011-05-13 23:27 +0100
Re: Encrypt/decrypt compatibility with Microsoft Crypto API? Trevor <trevorREMOVE@holyoak.com> - 2011-05-17 11:38 -0600
| From | Trevor <trevor@holyoak.com> |
|---|---|
| Date | 2011-05-11 15:03 -0600 |
| Subject | Encrypt/decrypt compatibility with Microsoft Crypto API? |
| Message-ID | <iqetjn$99q$2@dont-email.me> |
We have a Windows program that we have developed that uses the Microsoft Crypto API to encrypt/decrypt data using a shared secret from which it derives a session key. I now need to be able to access that same data (stored in a database) from our web site using PHP. I've used mcrypt before, but that doesn't appear to be a compatible solution. I've done enough research to see that I might be able to use OpenSSL, but I have not yet been able to determine whether I'll be able to decrypt data that was encrypted with the MS Crypto API (as well as the reverse). I've also looked at the possibility of accessing the MS Crypto API directly through PHP, but I haven't yet found a good way to do that. The other option is to write another Windows program that can be called from PHP, passing stuff on the commandline, and then receive output via a text file. I'm doing something similar to do some calculations for something else on the web site already - but it's not very fast. Any suggestions would be greatly appreciated! Thanks, Trevor
[toc] | [next] | [standalone]
| From | JohnT <john@example.com> |
|---|---|
| Date | 2011-05-11 22:15 +0000 |
| Message-ID | <iqf1pn$n8m$1@dont-email.me> |
| In reply to | #1535 |
On Wed, 11 May 2011 15:03:49 -0600, Trevor wrote: > We have a Windows program that we have developed that uses the Microsoft > Crypto API to encrypt/decrypt data using a shared secret from which it > derives a session key. > > I now need to be able to access that same data (stored in a database) > from our web site using PHP. I've used mcrypt before, but that doesn't > appear to be a compatible solution. I've done enough research to see > that I might be able to use OpenSSL, but I have not yet been able to > determine whether I'll be able to decrypt data that was encrypted with > the MS Crypto API (as well as the reverse). > When I did something similar, I wrote a C applet to do this. You can't use standard tools because Windows pads the data differently. I used mcrypt with rijndael-128 and cbc Has been working successfully for a number of years. In order to get it to work, I had to do the en/decryption both ways in windows, and keep the data at each step, then replicate the data at the linux side. I think the main issue is that on linux, the data is 0 padded. On windows, the data is padded with a byte containing the length (in bytes) of the padding. Regards JohnT
[toc] | [prev] | [next] | [standalone]
| From | Trevor <trevorREMOVE@holyoak.com> |
|---|---|
| Date | 2011-05-13 16:20 -0600 |
| Message-ID | <iqkaqr$5m4$1@dont-email.me> |
| In reply to | #1537 |
On 5/11/2011 4:15 PM, JohnT wrote: > When I did something similar, I wrote a C applet to do this. > You can't use standard tools because Windows pads the data differently. > > I used mcrypt with rijndael-128 and cbc > Has been working successfully for a number of years. > > In order to get it to work, I had to do the en/decryption both ways in > windows, and keep the data at each step, then replicate the data at the > linux side. > > I think the main issue is that on linux, the data is 0 padded. > On windows, the data is padded with a byte containing the length (in > bytes) of the padding. I'm actually running the php site on a Windows server, but it looks like the endian-ness may still be an issue. The Windows program was made with PowerBuilder, and since PowerBuilder is able to create .Net assemblies, and PHP is supposed to be able to use .Net assemblies, I thought it might be easiest to use the existing code and put it in an assembly. Turns out PHP's support for .Net assemblies is not all that great. Yes, the example at php.net for this functionality works, but as stated in several stagnant bug reports, other objects within the same mscorlib.dll assembly don't even work. Is is correct, as it appears, that development on DOTNET has ceased, leaving it not very usable? This has been one long week, with nothing really to show for it. :( - Trevor
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2011-05-13 23:27 +0100 |
| Message-ID | <iqkb9d$mrt$1@news.albasani.net> |
| In reply to | #1578 |
Trevor wrote: > On 5/11/2011 4:15 PM, JohnT wrote: > >> When I did something similar, I wrote a C applet to do this. >> You can't use standard tools because Windows pads the data differently. >> >> I used mcrypt with rijndael-128 and cbc >> Has been working successfully for a number of years. >> >> In order to get it to work, I had to do the en/decryption both ways in >> windows, and keep the data at each step, then replicate the data at the >> linux side. >> >> I think the main issue is that on linux, the data is 0 padded. >> On windows, the data is padded with a byte containing the length (in >> bytes) of the padding. > > I'm actually running the php site on a Windows server, but it looks like > the endian-ness may still be an issue. > > The Windows program was made with PowerBuilder, and since PowerBuilder > is able to create .Net assemblies, and PHP is supposed to be able to use > .Net assemblies, I thought it might be easiest to use the existing code > and put it in an assembly. > > Turns out PHP's support for .Net assemblies is not all that great. Yes, > the example at php.net for this functionality works, but as stated in > several stagnant bug reports, other objects within the same mscorlib.dll > assembly don't even work. Is is correct, as it appears, that development > on DOTNET has ceased, leaving it not very usable? > > This has been one long week, with nothing really to show for it. :( > > - Trevor I fear that is most peoples experience if trying to mix Microsoft with anything else. It nearly always curdles...;-) I spent a fruitless hour trying to get Word to understand any document I could produce 'cant open, out of memory' Gave up and installed open office on the wife's Mac..
[toc] | [prev] | [next] | [standalone]
| From | Trevor <trevorREMOVE@holyoak.com> |
|---|---|
| Date | 2011-05-17 11:38 -0600 |
| Message-ID | <iqubqa$ovu$1@dont-email.me> |
| In reply to | #1579 |
On 5/13/2011 4:27 PM, The Natural Philosopher wrote: >> The Windows program was made with PowerBuilder, and since PowerBuilder >> is able to create .Net assemblies, and PHP is supposed to be able to >> use .Net assemblies, I thought it might be easiest to use the existing >> code and put it in an assembly. >> >> Turns out PHP's support for .Net assemblies is not all that great. >> Yes, the example at php.net for this functionality works, but as >> stated in several stagnant bug reports, other objects within the same >> mscorlib.dll assembly don't even work. Is is correct, as it appears, >> that development on DOTNET has ceased, leaving it not very usable? >> >> This has been one long week, with nothing really to show for it. :( >> >> - Trevor > I fear that is most peoples experience if trying to mix Microsoft with > anything else. It nearly always curdles...;-) > > > I spent a fruitless hour trying to get Word to understand any document I > could produce 'cant open, out of memory' > > Gave up and installed open office on the wife's Mac.. I finally got it working. I used PowerBuilder.NET 12.1 to create the assembly, and used this library to call it from PHP: http://universalccw.sourceforge.net - Trevor
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web