D
dpomt
Hello,
I have an issue with X509Certificate2 constructur.
---------
FileStream fs = File.Open(m_strCertLocation, FileMode.Open,
FileAccess.Read);
byte[] buffer = new byte[fs.Length];
int count = fs.Read(buffer, 0, buffer.Length);
fs.Close();
X509Certificate2 cert = new X509Certificate2(buffer,
m_strCertPassword,X509KeyStorageFlags.MachineKeySet);
---------
throws an System.Security.Cryptography.CryptographicException: Access
denied when running IIS 5.0 or IIS 6.0 while it works fine with Cassini.
[CryptographicException: Access denied
]
System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr) +33
System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[]
rawData, IntPtr password, UInt32 dwFlags, Boolean persistKeySet,
SafeCertContextHandle& pCertCtx) +0
System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[]
rawData, Object password, X509KeyStorageFlags keyStorageFlags) +194
System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[]
rawData, String password, X509KeyStorageFlags keyStorageFlags
....
The code did run before without exception in IIS 5.0/6.0 but I had no
success in finding out what has changed since then.
Since Cassini runs with my user account that has admin rights, I have
temporarly added the ASPNET acoount to the admin group - but that did not
change anything.
m_strCertLocation is the filename with path two a crypted certificate that
is located in the App_Data directory of my web app.
Any suggestions?
Thanks,
Dieter
I have an issue with X509Certificate2 constructur.
---------
FileStream fs = File.Open(m_strCertLocation, FileMode.Open,
FileAccess.Read);
byte[] buffer = new byte[fs.Length];
int count = fs.Read(buffer, 0, buffer.Length);
fs.Close();
X509Certificate2 cert = new X509Certificate2(buffer,
m_strCertPassword,X509KeyStorageFlags.MachineKeySet);
---------
throws an System.Security.Cryptography.CryptographicException: Access
denied when running IIS 5.0 or IIS 6.0 while it works fine with Cassini.
[CryptographicException: Access denied
]
System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr) +33
System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[]
rawData, IntPtr password, UInt32 dwFlags, Boolean persistKeySet,
SafeCertContextHandle& pCertCtx) +0
System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[]
rawData, Object password, X509KeyStorageFlags keyStorageFlags) +194
System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[]
rawData, String password, X509KeyStorageFlags keyStorageFlags
....
The code did run before without exception in IIS 5.0/6.0 but I had no
success in finding out what has changed since then.
Since Cassini runs with my user account that has admin rights, I have
temporarly added the ASPNET acoount to the admin group - but that did not
change anything.
m_strCertLocation is the filename with path two a crypted certificate that
is located in the App_Data directory of my web app.
Any suggestions?
Thanks,
Dieter