G
Gregory L Priem
i have been unable to get any of the classes in the
System.Security.Cryptography namespace to work on my w2k machine, so i
created a vmware session starting from scratch, to remove any possible
external issues. [when run on winxp, no exceptions are seen]
setup: w2k pro with sp4 plus .net 1.1 redistributable. exe's are being
run interactively, by a user who is a member of the administrators
group.
i compiled the code from the command line [ie: csc crypto.cs] , which
gives the following info when run:
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
this whole process started with the following simple attempt to use
RijndaelManaged:
namespace n {
class c {
public static void Main() {
System.Security.Cryptography.RijndaelManaged aes =
new System.Security.Cryptography.RijndaelManaged();
}
};
}
this compiles without warnings, but produces the following exception
when run:
Unhandled Exception:
System.Security.Cryptography.CryptographicException: CryptoAPI
cryptographic service provider (CSP) for this implementation could not
be acquired.
at
System.Security.Cryptography.RNGCryptoServiceProvider..ctor(CspParameters
cspParams)
at System.Security.Cryptography.RijndaelManaged.GenerateKey()
at RijndaelManaged_Examples.MyMainClass.Main()
i soon discovered that exceptions are also thrown when trying to
create other classes [using default ctors]: DSACryptoServiceProvider,
DESCryptoServiceProvider, RC2CryptoServiceProvider,
RSACryptoServiceProvider, RNGCryptoServiceProvider,
MD5CryptoServiceProvider, SHA1CryptoServiceProvider. [i did not try
other classes, but i expect that they would have thrown exceptions as
well]
it looks like this error is typically seen by people using encryption
from asp.net, which is not what i am doing. just in case the normal
solution of using the machine key set might work, i tried the
following commonly-suggested code for the body of main:
CspParameters param = new CspParameters();
param.Flags = CspProviderFlags.UseMachineKeyStore;
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(param);
this also generated an exception:
Unhandled Exception:
System.Security.Cryptography.CryptographicException: Cryptographic
service provider (CSP) could not be found for this algorithm.
at
System.Security.Cryptography.RSACryptoServiceProvider.HasEnhancedProvider()
at
System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32
dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
at n.c.Main()
installation of the w2k High Encryption Pack had no effect.
am i missing something? MSDN indicates that w2k is supported.
greg priem kb0erz
bark, fido, bark [neither of us speak for my employer]
System.Security.Cryptography namespace to work on my w2k machine, so i
created a vmware session starting from scratch, to remove any possible
external issues. [when run on winxp, no exceptions are seen]
setup: w2k pro with sp4 plus .net 1.1 redistributable. exe's are being
run interactively, by a user who is a member of the administrators
group.
i compiled the code from the command line [ie: csc crypto.cs] , which
gives the following info when run:
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
this whole process started with the following simple attempt to use
RijndaelManaged:
namespace n {
class c {
public static void Main() {
System.Security.Cryptography.RijndaelManaged aes =
new System.Security.Cryptography.RijndaelManaged();
}
};
}
this compiles without warnings, but produces the following exception
when run:
Unhandled Exception:
System.Security.Cryptography.CryptographicException: CryptoAPI
cryptographic service provider (CSP) for this implementation could not
be acquired.
at
System.Security.Cryptography.RNGCryptoServiceProvider..ctor(CspParameters
cspParams)
at System.Security.Cryptography.RijndaelManaged.GenerateKey()
at RijndaelManaged_Examples.MyMainClass.Main()
i soon discovered that exceptions are also thrown when trying to
create other classes [using default ctors]: DSACryptoServiceProvider,
DESCryptoServiceProvider, RC2CryptoServiceProvider,
RSACryptoServiceProvider, RNGCryptoServiceProvider,
MD5CryptoServiceProvider, SHA1CryptoServiceProvider. [i did not try
other classes, but i expect that they would have thrown exceptions as
well]
it looks like this error is typically seen by people using encryption
from asp.net, which is not what i am doing. just in case the normal
solution of using the machine key set might work, i tried the
following commonly-suggested code for the body of main:
CspParameters param = new CspParameters();
param.Flags = CspProviderFlags.UseMachineKeyStore;
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(param);
this also generated an exception:
Unhandled Exception:
System.Security.Cryptography.CryptographicException: Cryptographic
service provider (CSP) could not be found for this algorithm.
at
System.Security.Cryptography.RSACryptoServiceProvider.HasEnhancedProvider()
at
System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32
dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
at n.c.Main()
installation of the w2k High Encryption Pack had no effect.
am i missing something? MSDN indicates that w2k is supported.
greg priem kb0erz
bark, fido, bark [neither of us speak for my employer]