I'm trying to figure out how to use the MCSAPI to do AES encryption with the ncipher cryptographic service provider (CSP). What puzzles me is that the AesCryptoServiceProvider constructor does not accept a CspParameters class, used to specify nCipher as the csp.
CspParameters cp = new CspParameters(24, "nCipher Enhanced RSA and AES Cryptographic Provider");
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(CspParameters) // works fine
AesCryptoServiceProvider aes = new AesCryptoServiceProvider(); // Constructor takes no parameters.
From what I can see The Rijndael classes also don't have a way to specify other third party CSP's. What am I missing? Is there a way to initialize my whole system to load a CSP for all subsequent cryptographic calls? Am I suppose to be using the CSP to just manage the symmetric key and then use the default AesCryptoServiceProvider to encrypt/decrypt? RSACryptoServiceProvider(CspParameters) works just fine. But I'm wanting to do symmetric encryption.
I'm needing to do this in C# .NET framework.
AES is an symmetric algorithm, so no CspParameters can be used.
nCipher is a hardware standard (see http://technet.microsoft.com/en-us/library/dd277354) so it may be, that your token can calculate the AES algorithm, but as everybody (Alice and Bob) needs to know the secret key there is no benefit to calculate or store the key on a hardware-token.
You can see how to use AesCryptoServiceProvider in the MSDN example, maybe you want to use AesManaged (there is also an example).