TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Gaurav Sharma
NA
19
53.9k
How to set 16 0's key value on TripleDESCryptoServiceProvider.
Sep 6 2011 8:34 AM
I want to set a known value for key in 3DES algorithm. But i have observed after using TripleDesCryptoServiceProvider in C# code and assigning all 16 0's as key my program gave error "Cryptographic Exception was unhandled"
Please have a look on my piece of code,
byte[] IV=new byte[8] {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
byte[] key = new byte[24] { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
TripleDESCryptoServiceProvider tDESalg = new TripleDESCryptoServiceProvider();
// Create a string to encrypt.
byte[] testData = new byte[8] { 0xD6,0x52,0xF9,0xCF,0x3F,0x31,0x7D,0xEC};
tDESalg.IV = IV;
tDESalg.Padding = PaddingMode.None;
tDESalg.Key = key; // Error Cryptographic Exception was unhandled. Specified key is a known weak key for 'TripleDES' and can't be used.
How to solve this issue. I don't want to use default key value coming from TDES and as per my requirement key value must all zero.
Reply
Answers (
1
)
How to sort struct fields data?
how to split sting