aes

AES to return Alphanumeric

纵饮孤独 提交于 2019-12-05 08:21:49
I have an aes encryption code, i want to make it only return alphanumerical characters like {0123456789ABCDEFGHIJKLMNOPQRSTWUVYZ} But however i could not figure out how to do that. I have almost no idea about encryption, could not figure out where to fix. I would really apreciate your feedback. Regards... public class clsCrypto { private string _KEY = string.Empty; protected internal string KEY { get { return _KEY; } set { if (!string.IsNullOrEmpty(value)) { _KEY = value; } } } private string _IV = string.Empty; protected internal string IV { get { return _IV; } set { if (!string.IsNullOrEmpty

C# equivalent of the Java SecretKeySpec for AES

与世无争的帅哥 提交于 2019-12-05 08:18:20
问题 I have following code written in java. I need C# equivalent for this. Key key = new SecretKeySpec(keyValue, "AES"); Cipher c = Cipher.getInstance("AES"); c.init(1, key); byte[] encVal = c.doFinal(Data.getBytes()); encryptedValue = new BASE64Encoder().encode(encVal); 回答1: Here C# code equivalent in java. System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding(); AesManaged tdes = new AesManaged(); tdes.Key = UTF8.GetBytes(keyValue); tdes.Mode = CipherMode.ECB; tdes.Padding = PaddingMode

Java AES-256 decrypt with IGE [closed]

五迷三道 提交于 2019-12-05 08:08:43
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm trying to decrypt AES-256 with IGE. But i don't know how use 256 bit key. in code key - byte[] with length == 32; IV . length == 32; BlockSize == 16 Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES")); Xprev = java.util.Arrays.copyOfRange

AES encryption & security flaw

二次信任 提交于 2019-12-05 08:05:03
问题 Check update#1 This logic is a candidate for a authentication procedure, done by simple HTTP requests: I'm sending: userName + encrypted_userName (encrypted_userName is actually the encrypted result of userName, done using AES & as key i use the md5 hash of the password). NOTE: I'm not sending the md5 hashed Password. on the server I'm comparing: encrypted_userName with own_encrypted_userName (since on server i have access to full info on user, i calculate own encrypted_userName). Question :

Rijndael AES-128 encryption decryption in Ruby

岁酱吖の 提交于 2019-12-05 08:04:41
问题 I want to use rijndael aes128 for encryption in ruby. I have this code: cipher = OpenSSL::Cipher::Cipher.new("aes-128-cbc") cipher.encrypt cipher.key = 'abcdef0123456789abcdef0123456789' cipher.iv = '0000000000000000' encrypted = cipher.update('2~1~000024~0910~20130723092446~T~00002000~USD~F~375019001012120~0~0~00000000000~') encrypted << cipher.final which is not working. But using this PHP function: <?php function hex2bin($hex_string) { return pack('H*', $hex_string); } $data_to_encrypt =

Not Encrypting & Decrypting Properly

梦想的初衷 提交于 2019-12-05 08:02:15
问题 Something is funky with the following AES class I've written to do encryption and decryption. When I copy of the AES object and I choose to encrypt plain text, and then I immediately attempt to decrypt the text I just encrypted, it doesn't decrypt it fully (and does it differently every time). e.g. I'm initializing it with a simple JSP like this: <%@page import="com.myclass.util.AES"%> <% String hexMessage =

Problems encoding/decoding using AES-128-CBC

别说谁变了你拦得住时间么 提交于 2019-12-05 07:54:11
问题 So basically I have these snippets of code and would like them to produce the same output: require 'openssl' aes = OpenSSL::Cipher::Cipher.new("AES-128-CBC") aes.key = "aaaaaaaaaaaaaaaa" aes.iv = "aaaaaaaaaaaaaaaa" aes.encrypt encrypted = aes.update("1234567890123456") << aes.final puts encrypted.unpack('H*').join This prints: 8d3bbffade308f8e4e80cb77ecb8df19ee933f75438cec1315c4a491bd1b83f4 And this Java code: Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); String key =

CryptoJs Encryption is not working in android

早过忘川 提交于 2019-12-05 07:46:53
问题 I have to implement encryption in android app. The web developer is using CryptoJs library. means Encryption alog is AES256 encryption. Both iOS and android platforms give different strings and iOS one is accepted at web.It should be same for sample strings. I am using below code snippets (there are 2 different diffrent functions): private void newEnc() { String secret = "LSC@SD2017@ps"; String cipherText = "{\"device_type\":\"iOS\",\"email\" : \"jhon@gmail.com\",\"device_id\" : \"14105DA4

Java (Android) Decrypting msg with IV attached

孤街浪徒 提交于 2019-12-05 07:41:58
问题 I generate a random IV, this IV is attached (in plain bytes) to front of the encrypted msg as shown below; public String encrypt(String plainText, byte[] encryptionKey) throws Exception { SecretKeySpec key = new SecretKeySpec(encryptionKey, "AES"); cipher.init(Cipher.ENCRYPT_MODE, key, iV); byte[] data = new byte[iV.getIV().length + plainText.getBytes("UTF-8").length]; // Merge together plain IV and encrypted cipher text System.arraycopy(iV.getIV(), 0, data, 0, iV.getIV().length); System

AES File decrypting “given final block not properly padded”

做~自己de王妃 提交于 2019-12-05 07:32:44
问题 I want to encrypt and then decrypt file use AES. I have read many topics about error "Given final block not properly padded" . But i don't find solution for me. Sorry about specify the language of my code, i don't know write language java Here is my code : Variables // IV, secret, salt in the same time private byte[] salt = { 'h', 'u', 'n', 'g', 'd', 'h', '9', '4' }; public byte[] iv; public SecretKey secret; createSecretKey public void createSecretKey(String password){ SecretKeyFactory