I'm receiving a file encrypted with TripleDES by a .Net process. The code they are using is:
class TripleDES { private static System.Security.Cryptography.TripleDES CreateDES(string key) { MD5 md5 = new MD5CryptoServiceProvider(); System.Security.Cryptography.TripleDES des = new TripleDESCryptoServiceProvider(); des.Key = md5.ComputeHash(Encoding.UTF8.GetBytes(key)); des.IV = new byte[des.BlockSize/8]; return des; } public static byte[] Encryption(string PlainText, string key) { var des = CreateDES(key); var ct = des.CreateEncryptor(); var input = Encoding.UTF8.GetBytes(PlainText); return ct.TransformFinalBlock(input, 0, input.Length); } } I've tried decrypting (with no success) using this: // key used to encrypt == "shfTbs.set" --> not padded to 8 bytes? func decryptIt(cryptoBytes []byte, key string) { triplekey := []byte(GetMD5Hash(key)) // "shfTbs.set" block, err := des.NewTripleDESCipher(triplekey) if err != nil { fmt.Printf("%s \n", err.Error()) os.Exit(1) } iv := triplekey[:des.BlockSize] decrypter := cipher.NewCBCDecrypter(block, iv) decrypted := make([]byte, len(cryptoBytes)) decrypter.CryptBlocks(decrypted, encrypted) fmt.Printf("%s", decrypted) <-- Nope, doesn't successfully decrypt } func GetMD5Hash(text string) string { hasher := md5.New() hasher.Write([]byte(text)) return hex.EncodeToString(hasher.Sum(nil)) } * Any help would be greatly appreciated!* -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.