Goeiemiddag,
ik ben al een dag bezig om met capicom een web certificaat uit te lezen, maar ergens wringt er nog wat. Hieronder mijn functie:
En hier de foutmelding:
Cannot find the requested object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Cannot find the requested object.
Source Error:
Line 24: //bool bBool = CCC.Archived;
Line 25: //CCC.Display();
Line 26: iCC.Import(sByteString);
Line 27: CCC.ICertificate_Import(sByteString);
Line 28: //string sIssuer = CCC.ICertificate_IssuerName;
Source File: d:\projects\dotnet\contentgenie\cg2.capicom\capicom.cs Line: 26
Stack Trace:
[COMException (0x80092009): Cannot find the requested object.]
CAPICOM.CertificateClass.ICertificate_Import(String EncodedCertificate) +0
--- rest van stacktrace niet belangrijk ---
Wat is the missing link.
tia,
Youri
ik ben al een dag bezig om met capicom een web certificaat uit te lezen, maar ergens wringt er nog wat. Hieronder mijn functie:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| ( Certificate is de property Certificate van de HttpClientCertificate klasse, is gewoon gevuld)
public static string GetSubjectAlternativeName(byte[] Certificate)
{
string sSubAltName = "";
// hieronder staan de drie mogelijkheden die ik geprobeerd heb, alleen geven zelfde fout en probeer er natuurlijk maar 1 tegelijk
CAPICOM.Certificate CCC = new CertificateClass();
CAPICOM.CertificateClass CCC = new CertificateClass();
CAPICOM.ICertificate iCC = new CertificateClass();
CAPICOM.Utilities CUT = new UtilitiesClass();
string sByteString = CUT.ByteArrayToBinaryString(Certificate);
//de functies hieronder geven aan dat de class niet is geinitialiseerd, maar kan ook zijn omdat er nog niets instaat, dat hij daarom die fout geeft
//bool bBool = CCC.Archived;
//CCC.Display();
//HIERONDER de echte regels waar het om draait. Elke van deze regels geeft een foutmelding
iCC.Import(sByteString);
CCC.Import(sByteString);
CCC.ICertificate_Import(sByteString);
foreach(Extension Extension in CCC.Extensions())
{
if (Extension.OID.FriendlyName == "Subject Alternative Name")
{
sSubAltName = Extension.EncodedData.Format(true);break;
}
}
return sSubAltName;
} |
En hier de foutmelding:
Cannot find the requested object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Cannot find the requested object.
Source Error:
Line 24: //bool bBool = CCC.Archived;
Line 25: //CCC.Display();
Line 26: iCC.Import(sByteString);
Line 27: CCC.ICertificate_Import(sByteString);
Line 28: //string sIssuer = CCC.ICertificate_IssuerName;
Source File: d:\projects\dotnet\contentgenie\cg2.capicom\capicom.cs Line: 26
Stack Trace:
[COMException (0x80092009): Cannot find the requested object.]
CAPICOM.CertificateClass.ICertificate_Import(String EncodedCertificate) +0
--- rest van stacktrace niet belangrijk ---
Wat is the missing link.
tia,
Youri