tags:

views:

37

answers:

1

Hi

Could anybody tell me what the equivalent .NET classes/methods are to the following Java methods:

decryptCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
decryptCipher.init(2, getKey(0));
decryptCipher.doFinal(data);

where getKey() returns an object of type SecretKeySpec (data is dummy):

public static Key getKey(int cipher) {
    if (cipher == 0) {
      return new SecretKeySpec(new byte[] { 1, 1, 1, 1, 1, 1, 1, 1 }, "DES");
    }
    return new SecretKeySpec(new byte[] { 2, 2, 2, 2, 2, 2, 2, 2 }, "DES");
  }

Many thanks

Tony

+1  A: 

The actual class which provides DES cryptography: http://msdn.microsoft.com/en-us/library/system.security.cryptography.descryptoserviceprovider.aspx In addition, you may want to read this up :) http://msdn.microsoft.com/en-us/library/92f9ye3s.aspx

Louis Rhys