Click here to Skip to main content
15,896,207 members
Home / Discussions / C#
   

C#

 
GeneralRe: Moving huge amounts of Data over Local/Lan Pin
Sharpoverride6-May-05 1:50
Sharpoverride6-May-05 1:50 
GeneralVS .NET Server Explorer Add-in Pin
rsdouglas5-May-05 1:22
rsdouglas5-May-05 1:22 
GeneralDefault values for properties Pin
WujekSamoZlo4-May-05 23:35
WujekSamoZlo4-May-05 23:35 
GeneralRe: Default values for properties Pin
Stefan Troschuetz5-May-05 0:34
Stefan Troschuetz5-May-05 0:34 
GeneralRe: Default values for properties Pin
Maqsood Ahmed5-May-05 0:35
Maqsood Ahmed5-May-05 0:35 
Generalcombo box in datagrid Pin
steve_rm4-May-05 22:17
steve_rm4-May-05 22:17 
GeneralRe: combo box in datagrid Pin
MoustafaS5-May-05 0:50
MoustafaS5-May-05 0:50 
GeneralRSACryptoServiceProvider Error Pin
Sandeep.Thammadi4-May-05 21:20
sussSandeep.Thammadi4-May-05 21:20 
Brief: Iam working on an enhancement for our product. This requires integration with Document Management System. The DMS(Document Managemen System) works on Citrix environment, which has Server and Client components, which our product needs to use for communication between citrix server(where our application is published) and client (where we run our application from, using seamless citrix connection).

We are supposed to encryt some data on the citrix server and pass it to citrix client, for which we have developed an encryption component. This component uses RSACrytoServiceProvider's encryption using certificates.
The following is the code for encryption:

//Convert the data that we wish to encrypt into a byte array
byte bytDataToEncrypt[] = ASCIIEncoding.ASCII.GetBytes(strDataToEncrypt);

// Get the RSA parameters from the certificate - since this we
// are encrypting using the public keys in the certificate
// we pass the false parameter so that the private keys are not exported
RSAParameters objPublicKey = bjCertificate.PublicKey.ExportParameters(false);

// create the crypto service to use for the encryption
RSACryptoServiceProvider objRSA = new RSACryptoServiceProvider();

// Use the previously obtained RSA parameters
objRSA.ImportParameters (objPublicKey); (where objPublicKey is the encrypting certificate object)

// perform the encryption
byte bytEncryptedData [] = objRSA.Encrypt(bytDataToEncrypt, false);

//If Encrypted Data is not null
string strEncryptedData;
if(bytEncryptedData != null)
//Convert the encrypted byte data to hex
strEncryptedData = ConvertByteToHex(bytEncryptedData);
else
strEncryptedData = string.Empty;

return strEncryptedData;

The Encryption component successfully finds the encryption certificate. But while creating a RSACryptoServiceProvider object I get the following error.
"Crypto API cryptographic service provider (CSP) for this implementation could not be acquired".

After finding an article for the above error in web, I have made the following changes in the above code as follows:

// Create the crypto service to use for the encryption
CspParameters CSPParam = new CspParameters();
CSPParam.Flags = CspProviderFlags.UseMachineKeyStore;
objRSA = new RSACryptoServiceProvider(CSPParam);

Also gave “Full Control” permissions to the following path for “ANONYMOUS LOGON” user on Citrix server machine:
“C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys”

I then got the following error:
“Access Denied”

Later I gave “full control” permissions to “EVERYONE” user, to the above path.
Then the encryption part worked fine. But when this encrypted data is passed from the Citrix server by the DMS server component to Citrix client. the DMS client component on Citrix client is not able to decrypt the data. It gives the following error:
"Error decrypting: The total input data is not a multiple of block size. The block size is: 128"

I guess that there might be some problem with access rights for “ANONYMOUS LOGON” user or usage of CspParameters. I also tried to know more about the error by using the File and Registry Monitoring tools available at www.sysinternals.com. But I am not able to find out where the exact problem lies.

Please HELP !

Thanx in advance

Generalcheckbox in combobox Pin
sianatia4-May-05 21:15
sianatia4-May-05 21:15 
GeneralRe: checkbox in combobox Pin
MoustafaS5-May-05 0:52
MoustafaS5-May-05 0:52 
GeneralHelp required abt Dynamic dll. Pin
Shashidharreddy4-May-05 20:21
Shashidharreddy4-May-05 20:21 
GeneralRe: Help required abt Dynamic dll. Pin
keith maddox5-May-05 5:47
keith maddox5-May-05 5:47 
GeneralRe: Help required abt Dynamic dll. Pin
Shashidharreddy6-May-05 0:03
Shashidharreddy6-May-05 0:03 
GeneralGet Excel-Word ref Pin
MBGeorge4-May-05 20:06
MBGeorge4-May-05 20:06 
GeneralHelp -- TreeView Pin
Umair Tariq4-May-05 20:05
Umair Tariq4-May-05 20:05 
GeneralRe: Help -- TreeView Pin
S. Senthil Kumar4-May-05 21:36
S. Senthil Kumar4-May-05 21:36 
GeneralOpening mdi child from mdi child Pin
ninja26054-May-05 20:01
ninja26054-May-05 20:01 
GeneralRe: Opening mdi child from mdi child Pin
Dave Kreskowiak5-May-05 4:32
mveDave Kreskowiak5-May-05 4:32 
GeneralRe: Opening mdi child from mdi child Pin
ninja26055-May-05 19:29
ninja26055-May-05 19:29 
GeneralRe: Opening mdi child from mdi child Pin
Dave Kreskowiak6-May-05 2:08
mveDave Kreskowiak6-May-05 2:08 
GeneralRe: Opening mdi child from mdi child Pin
ninja26056-May-05 3:57
ninja26056-May-05 3:57 
Generalsms to mobiles from Web application Pin
din butt4-May-05 19:57
din butt4-May-05 19:57 
GeneralNeed help with translation from VB.Net Pin
royg774-May-05 19:53
royg774-May-05 19:53 
GeneralRe: Need help with translation from VB.Net Pin
Mathew Hall4-May-05 20:27
Mathew Hall4-May-05 20:27 
GeneralRe: Need help with translation from VB.Net Pin
royg774-May-05 22:25
royg774-May-05 22:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.