ID: 26580
User updated by: tauras dot paliulis at tauras dot com
Reported By: tauras dot paliulis at tauras dot com
Status: Open
Bug Type: COM related
Operating System: Windows 2000
PHP Version: 4.3.4
New Comment:
Little explanation: if i'm dismissing 20th line, i'm receiving warning
"(null)(): Invoke()
failed: The parameter is incorrect" to lines 21 and 22
Previous Comments:
------------------------------------------------------------------------
[2003-12-10 07:55:54] tauras dot paliulis at tauras dot com
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 this bug report at http://bugs.php.net/?id=26580&edit=1