Click here to Skip to main content
15,122,845 members

Comments by i_syed2000 (Top 7 by date)

i_syed2000 13-Oct-17 11:06am View
   
Can you explain how that works. It seems to be working for me as well. But I'm little confused how it is working. Is it because the code generation are built into the .net run time itself?
i_syed2000 22-Jun-16 15:30pm View
   
Thanks xszaboj. But do you know if these tools are written by Microsoft using C/C++/.NET and Microsoft gave them the same name as NodeJs tools for sake ease?
i_syed2000 27-May-16 12:31pm View
   
Its really big DB. I think foreign key constraints gets in the way of high volume transactional applications. But that may be another debate.
i_syed2000 27-May-16 12:02pm View
   
Also there is no relationship defined between tables in the Database. Do you think it is possible to map that table structure to the domain model structure using the fluent API?
i_syed2000 27-May-16 10:42am View
   
Thanks Dave. I'm sorry if I wasn't clear enough. You have Implemented DB Context correctly. However, I want to mention that table structure is existing. I will not be able to change it. Is it possible make this class hierarchy work with the table structure I have mentioned.
i_syed2000 10-Jul-13 17:49pm View
   
Okay. So lets say my encrypted log file is 200 MB Long after months of log writing. I can load the whole file in Memory, decrypt it and show all at once to the user. However, I'm trying avoid hogging user's memory. If I decide to move forward with it, I will probably switch to AES. But first, I need to solve the problem mentioned above.

The problem part is the padding. Padding is only applied when the data block size is less than 64 bits. For some reason, .net code is not updating the 'decrypted' memory stream.
See code below.

Sample String Encrypted: ABCDEFGHI
Total Encrypted Bytes: 16 (because of padding).
Goal: Decrypt and read the first block which contains 'ABCDEFGH'.

string DecryptData(string encryptedData)
{
byte[] dataToDecrypt = Convert.FromBase64String(encryptedData);
byte[] decryptedData = new byte[8];
DESCryptoServiceProvider secProvider = new DESCryptoServiceProvider();
secProvider.Mode = CipherMode.ECB;
secProvider.Padding = PaddingMode.PKCS7;
secProvider.Key = ASCIIEncoding.ASCII.GetBytes(encryptionKey);
ICryptoTransform transform = secProvider.CreateDecryptor();
MemoryStream encryptedDataStream = new MemoryStream(dataToDecrypt);
MemoryStream decryptedDataStream = new MemoryStream();

CryptoStream stream = new
CryptoStream(decryptedDataStream,transform,CryptoStreamMode.Write);
stream.Write(dataToDecrypt, 0, 8);
stream.Flush();
//PROBLEM: doesn't flush bytes to decryptedDataStream unless I change padding to 'None'.
}
i_syed2000 10-Jul-13 17:28pm View
   
Thanks Sergey. When using the ECB mode with DES, each block is encrypted standalone using the same key. So you can read each block and decrypt it independently of all the other blocks. In practice, I would really be reading one 'log line' which may span over mutiple encryption blocks.

For example consider the following log lines.
Line 1: Entering Method ABC\r\n
Line 2: Saving Customer\r\n
Line 3: Exiting Method ABC\r\n

Line 1 may span block 0 to N
Line 2 may span block N+1 to M
Line 3 may span block M+1 to ..