From: tauras dot paliulis at tauras dot com
Operating system: Windows 2000
PHP version: 4.3.4
PHP Bug Type: COM related
Bug description: PHP and/or Apache/IIS crashes on trying to submit data
Description:
------------
Hi,
I'm trying to connect over COM to standard .net and MS CAPICOM
cryptography functions.
if i'm dismissing 20th line, i'm receiving warning "(null)(): Invoke()
failed: The parameter is incorrect".
Then I tried to insert VARIANT with different types and receiving the same
warning. But when I did VT_VARIANT, then Apache/2.0.47 restarted and log
shows an error "[notice] Parent: child process exited with status
3221225477 -- Restarting."
When the same script was run on IIS/5 I received new warning "(null)():
Invoke() failed: No such interface supported in ..." on 19th line, while
apache did understand this. Also other warning were as in apache.
When I tried to define value VARIANT as VT_VARIANT, I received warning
"Warning: VT_VARIANT is invalid. Use VT_VARIANT|VT_BYREF instead. in
c:\inetpub\wwwroot\crypt.php on line 50
PHP has encountered an Access Violation at 01914F48"
What's a matter?
BR,
Tauras
Reproduce code:
---------------
1:$store = new COM("capicom.Store");
2:$csp = new COM("System.Security.Cryptography.CspParameters");
3:$rsa = new
COM("System.Security.Cryptography.RSACryptoServiceProvider");
4:$pkcs1 = new
COM("System.Security.Cryptography.RSAPKCS1SignatureFormatter");
5:$tobyte = new COM("System.Text.ASCIIEncoding");
6:$store->Open($storelocation, $storename, 0);
7:for ($i=1; $i<=$store->Certificates->Count; $i++) {
8: $cert = $store->Certificates->Item($i);
9: if ($cert->HasPrivateKey() && $cert->SubjectName == $signername &&
$cert->IssuerName == $issuername && $cert->ValidFromDate<=time() &&
$cert->ValidToDate>=time()) {
10: $certfound = true;
11: break;}}
12:if (!isset($certfound)) return false;
13:$csp->ProviderType = $cert->PrivateKey->ProviderType;
14:$csp->ProviderName = $cert->PrivateKey->ProviderName;
15:$csp->KeyContainerName = $cert->PrivateKey->ContainerName;
16:$csp->Flags = 1;
17:$rsa->PersistKeyInCsp = true;
18:$pkcs1->SetHashAlgorithm("SHA1");
19:$pkcs1->SetKey($rsa);
20:$varstr = new VARIANT ($unsignedstring, VT_VARIANT);
21:$counter=$tobyte->GetBytes($varstr);
22:$signed = $pkcs1->CreateSignature($counter);
--
Edit bug report at http://bugs.php.net/?id=26580&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26580&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26580&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26580&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26580&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26580&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26580&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26580&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26580&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26580&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26580&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26580&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26580&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26580&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26580&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26580&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26580&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26580&r=float