Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
K

karpolu

@karpolu
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Cannot use Java generated DES Key in C#
    K karpolu

    I figured it out. The key needed to be converted into an 8 byte array.

    public static byte[] toBytes(string text)
    {
    char[] dash = { '-', '\n', '\r' };
    String[] values = text.Split(dash);
    byte[] keyArray = new byte[8];
    for (int i = 0; i < values.Length; i++)
    {
    int elem = Convert.ToInt32(values[i]);
    elem = elem & 0x00FF;
    keyArray[i] = (byte)elem;
    }
    return keyArray;
    }

    Thanx, Karl

    C# csharp java algorithms help tutorial

  • Cannot use Java generated DES Key in C#
    K karpolu

    Greetings, I am developing an application that reads a DES encrypted password generated using Java in a properties file and decrypts it, using DESCryptoServiceProvider. I am provided with the key string originally generated with Java using DES. Does anyone have an example or sample code that converts/uses a Java generated key to decrypt a Java generated password in C#? After removing the dashes, I get the "Specified key is not a valid size for this algorithm" exception. I've tried both of these lines of code and get the same error: static byte[] key = ASCIIEncoding.ASCII.GetBytes(dashKey.Replace("-", "")); OR static byte[] key = Encoding.ASCII.GetBytes(dashKey.Replace("-", "")); The error occurrs at either of the below lines of code I tried: cryptoProvider.Key = key; OR ICryptoTransform decryptor = cryptoProvider.CreateDecryptor(key, iv); Thanks, Karl

    C# csharp java algorithms help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups