Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A QuizPlease log in to access this content. You will be redirected to the login page shortly.
LoginGeneral Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
The Encrypt and Decrypt functions in ExactTarget use different methods to encrypt. So encrypting with AES can't be decrypted with AES in PHP.
Actually I remember doing this a while ago. I managed to recreate the DES ECB PKCS7 Algorithm in C#.
Basically what needs to be done is to convert the plain text password to Hex
Base64Hex.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace base64Hex
{
class Program
{
static string key = "THISISTHEKEY";
static byte[] bytekey;
static void Main(string[] args)
{
//bytekey = Convert.FromBase64String(key);
bytekey = Encoding.UTF8.GetBytes(key);
key = BitConverter.ToString(bytekey).Replace("-", string.Empty);
Console.WriteLine("0x" + key);
Console.ReadLine();
}
}
}
DESTest.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security.Cryptography; using System.IO; using System.Diagnostics; namespace DESTest { class Program { static string encKey = "KEY GENERATED FROM ABOVE"; static byte[] dec; static string url = ""; ////// Output encrypted URL /// /// static void Main(string[] args) { var encryptedCode = Encrypt("TextToBeEncrypted"); var decryptedCode = Decrypt(encryptedCode); } ////// Decrypt an encrypted string. /// /// /// <returns>returns> public static string Decrypt(string encryptedString) { DESCryptoServiceProvider desProvider = new DESCryptoServiceProvider(); desProvider.Mode = CipherMode.ECB; desProvider.Padding = PaddingMode.PKCS7; dec = Convert.FromBase64String(encKey); desProvider.Key = dec; using (MemoryStream stream = new MemoryStream(Convert.FromBase64String(encryptedString))) { using (CryptoStream cs = new CryptoStream(stream, desProvider.CreateDecryptor(), CryptoStreamMode.Read)) { using (StreamReader sr = new StreamReader(cs, Encoding.UTF8)) { return Convert.FromBase64String(sr.ReadToEnd()).ToString(); } } } } ////// Encrypt a string with DES ECB -> Base64Encoded /// /// /// <returns>returns> public static string Encrypt(string stringtodecrypt) { DESCryptoServiceProvider desProvider = new DESCryptoServiceProvider(); desProvider.Mode = CipherMode.ECB; desProvider.Padding = PaddingMode.PKCS7; dec = Convert.FromBase64String(encKey); desProvider.Key = dec; using (MemoryStream stream = new MemoryStream()) { using (CryptoStream cs = new CryptoStream(stream, desProvider.CreateEncryptor(), CryptoStreamMode.Write)) { byte[] data = Encoding.UTF8.GetBytes(stringtodecrypt); cs.Write(data, 0, data.Length); cs.FlushFinalBlock(); return Convert.ToBase64String(stream.ToArray());
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Please log in to access this content. You will be redirected to the login page shortly.
LoginReady to take your education and career to the next level? Register today and join our growing community of learners and professionals.
manpreet
Best Answer
2 years ago
I am trying to understand how AMPscript EncryptSymmetric or DecryptSymmetric might work with openssl or mcrypt in PHP.
Essentially - is there a way to use AMPscript to encrypt, and PHP to decrypt? It seems like no matter what I try, it's just not working on one side or another. I'm able to encrypt/decrypt on AMPscript or on PHP, but can't seem to cross over.