I am passing in a byte array, but the wrong method is getting invoked.
However if I initialize the array manually it calls the right one!
Object reference not set to an instance of an object.
at
System.Security.Cryptography.X509Certificates.X509Certificate.BuildFromConte
xt(IntPtr handle)
at
System.Security.Cryptography.X509Certificates.X509Certificate..ctor(IntPtr
handle)
at Microsoft.Web.Services2.Security.X509.X509Certificate..ctor(IntPtr
handle)
at
Microsoft.Web.Services2.Security.X509.X509CertificateStore.get_Certificates(
)
at JavaScience.PfxOpen.SavePfx()
From my code, added to the example off of
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncapi/html/pkc
s12.asp
byte[] bits = pfxcert.GetRawCertData();
Microsoft.Web.Services2.Security.X509.X509Certificate ws2Cert = new
Microsoft.Web.Services2.Security.X509.X509Certificate(bits);
I tried with Byte[] as well, the docs use the two interchangeably (!!).
I forgot - if I call it like this it calls the correct ctor:
byte[] bits = new byte[3] {1,2,3};
Microsoft.Web.Services2.Security.X509.X509Certificate ws2Cert = new
Microsoft.Web.Services2.Security.X509.X509Certificate(bits);
Input data cannot be coded as a valid certificate.
at
System.Security.Cryptography.X509Certificates.X509Certificate.SetX509Certifi
cate(Byte[] data)
at
System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[]
data)
at Microsoft.Web.Services2.Security.X509.X509Certificate..ctor(Byte[]
rawCertificate)
at JavaScience.PfxOpen.SavePfx()
But I can print out the bytes getting set in the below section and they are
as valid as those above, no idea why the wrong ctor is being called.
owen
> I am passing in a byte array, but the wrong method is getting invoked.
> However if I initialize the array manually it calls the right one!
>
> Object reference not set to an instance of an object.
> at
System.Security.Cryptography.X509Certificates.X509Certificate.BuildFromConte
> xt(IntPtr handle)
> at
[quoted text clipped - 3 lines]
> handle)
> at
Microsoft.Web.Services2.Security.X509.X509CertificateStore.get_Certificates(
> )
> at JavaScience.PfxOpen.SavePfx()
>
> From my code, added to the example off of
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncapi/html/pkc
s12.asp
> byte[] bits = pfxcert.GetRawCertData();
>
> Microsoft.Web.Services2.Security.X509.X509Certificate ws2Cert = new
> Microsoft.Web.Services2.Security.X509.X509Certificate(bits);
>
> I tried with Byte[] as well, the docs use the two interchangeably (!!).