RadhaKrishnaKiJaya
asked on
Encryption Keys (Understand Code)
Hello Experts,
Here is the partial code of my Encryption program which encrypts the data in 256 bits. Here I am trying to understand the code to take it to next level.
1. What is the meaning of Encryption.m_Key = new byte[0x20] ? Why it is [0x20], not [0x22] ?
2. What is the meaning of Encryption.m_IV = new byte[0x10] ? Why it is [0x10], not [0x11] ?
3. How line 1 and 2 are related? I mean to say byte[0x20] and byte[0x10]. Does the 2nd one needs to be 10 byte long because 1st one is 20 bytes?
4. Why do we use m_IV? Does the name matter here?
Please answer the above questions if possible. FYI, I am not allowed to post the code. I modified it as little as possible for explaining things.
Thank you very much in advance.
public void GenerateKey()
{
Encryption.m_Key = new byte[0x20];
Encryption.m_IV = new byte[0x10];
RegistryKey key2 = Registry.LocalMachine.Open SubKey("XX XXXXX").Op enSubKey(" SubKey2");
if (key2 != null)
{
RegistryKey key3 = key2.OpenSubKey("SubKey3") ;
if (key3 != null)
{
.
.
.
}
}
}
Here is the partial code of my Encryption program which encrypts the data in 256 bits. Here I am trying to understand the code to take it to next level.
1. What is the meaning of Encryption.m_Key = new byte[0x20] ? Why it is [0x20], not [0x22] ?
2. What is the meaning of Encryption.m_IV = new byte[0x10] ? Why it is [0x10], not [0x11] ?
3. How line 1 and 2 are related? I mean to say byte[0x20] and byte[0x10]. Does the 2nd one needs to be 10 byte long because 1st one is 20 bytes?
4. Why do we use m_IV? Does the name matter here?
Please answer the above questions if possible. FYI, I am not allowed to post the code. I modified it as little as possible for explaining things.
Thank you very much in advance.
public void GenerateKey()
{
Encryption.m_Key = new byte[0x20];
Encryption.m_IV = new byte[0x10];
RegistryKey key2 = Registry.LocalMachine.Open
if (key2 != null)
{
RegistryKey key3 = key2.OpenSubKey("SubKey3")
if (key3 != null)
{
.
.
.
}
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Encryption.m_Key = new byte[0x10] No, it should be 32 bytes so use 0x20
Encryption.m_IV = new byte[0x10] Yes
Encryption.m_IV = new byte[0x10] Yes
ASKER
Thank you Andy and Sara. You guys are great! Thank you again!!
ASKER
Encryption.m_Key = new byte[0x10]
Encryption.m_IV = new byte[0x10]