Forgot your password?
Sign in with
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Python questions
View Java questions
All Message Boards...
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Design and Architecture
Internet of Things
C / C++ / MFC
ATL / WTL / STL
Objective-C and Swift
Hardware & Devices
Hosting and Servers
.NET (Core and Framework)
Site Bugs / Suggestions
Spam and Abuse Watch
The Insider Newsletter
The Daily Build Newsletter
Most Valuable Professionals
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
What is 'CodeProject'?
Ask a Question
Bugs and Suggestions
Article Help Forum
Comments by i_syed2000 (Top 7 by date)
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?
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?
Its really big DB. I think foreign key constraints gets in the way of high volume transactional applications. But that may be another debate.
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?
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.
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;
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
stream.Write(dataToDecrypt, 0, 8);
//PROBLEM: doesn't flush bytes to decryptedDataStream unless I change padding to 'None'.
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 ..
Last Updated 1 Jan 1900
All Rights Reserved.