Questions tagged [aes]

1

votes
1

answer
5.9k

Views

javax.crypto.IllegalBlockSizeException: Input length not multiple of 16 bytes

I have an ArrayList which contains some objects. Object is a container for login/pass. I try to decode them because i have to serialize them into local file for recreation after another launch. Problem is during encryption I recieve javax.crypto.IllegalBlockSizeException: Input length not multiple...
rainbow
0

votes
0

answer
12

Views

AES Encryption failed on last line of file when using same FileStream as CryptoStream

I am trying to create an AES encryption method where the same file is read and write at the same time. Other codes I have read all create a new file, I don't want to have new file. Other encrypted line matched my reference output from separate output, except my method generated an incorrect last lin...
Wylie Yyyy
0

votes
0

answer
8

Views

AES-256 encryption/decryption

I'm sure I'm missing something but I'm struggling to understand what! I encrypt a dummy string online on this website with AES-256: https://www.devglan.com/online-tools/aes-encryption-decryption with the following parameters: text to encrypt: This is a test! Mode: CBC Key size in bit: 256 Enter IV...
Kasper
0

votes
0

answer
14

Views

Encrypting and then decrypting a string in PHP

My encryption function works fine but I cannot reverse it into decryption function. How to do that? Any thoughts? Here is my code //CORRECT ENCRYPTION METHOD function encrypt($data) { $key = "SiadajerSiadajer"; $iv_size = 16; $iv = openssl_random_pseudo_bytes($iv_size, $strong); $encryptedData = op...
Pozeracz Sloikow
1

votes
0

answer
10

Views

Encryption using symmetric openssl aes-128-cbc SHA256 encryption

Problem: Want to achieve symmetric encryption using openssl aes-256-cbc -a -in avengers.txt -out avengers.enc -md md5 so if I pass the encrypted text in below code or in openssl aes-256-cbc -a -d -in avengers.enc -md md5 I get the actual strong. Can anyone help me in factoring the below code to do e...
QubesX
1

votes
1

answer
1.1k

Views

Decrypting data encrypted with AES-256-CBC in C# as with PHP

I did some encryption using PHP in my Database and would normally decrypt using: $encrypt_method = "AES-256-CBC"; $secret_key = "testing"; $secret_iv = "testingyes!!!"; $key = hash('sha256', $secret_key); // hash the key $iv = substr(hash('sha256', $secret_iv), 0, 16); // iv - encrypt method AES-256...
D. Rattansingh
1

votes
1

answer
980

Views

Using AES Encryption for sensitive data in MYSQL - Implementation Questions

There are a number of questions that discuss storing sensitive information in MYSQL using encryption. Some make great suggestions about hardening the web server, database server, and web application (Store 'sensitive' data in MySQL DB). However, little has been discussed about the exact implementati...
OverlordvI
1

votes
1

answer
2.3k

Views

JS libraries required for CryptoJS Encryption

I am trying to use CryptoJS for encryption using the code snippets from an upvoted answer of CryptoJS AES encryption and Java AES decryption. var text = "The quick brown fox jumps over the lazy dog. 👻 👻"; var secret = "René Über"; var encrypted = CryptoJS.AES.encrypt(text, secret); encrypted...
Arunabh
1

votes
1

answer
243

Views

Why is an error thrown in Python cryptography RSA decryption of encrypted AES key?

I am trying to decrypt an AES key from a DER-encoded file that has been encrypted in RSA format. With the following code: for key, value in configfile['File Extensions'].items(): if filename.endswith(value): pemFile=r'C:\Users\Public\Music\Sample Music\pkcs7.pem' with open(pemFile,'r') as f: pem = f...
Sheela Singla
1

votes
2

answer
38

Views

Decryption problem using AES/CBC in android

I am working to make a simple application that encrypts and decrypts a string using AES algorithm with CBC, the encryption is working, while the decryption is not working at all and giving null result when I used to set text to the edit text in the xml, so can anyone help me please? below is my code...
wisam
1

votes
1

answer
67

Views

Trouble decrypting bytes with ECB mode encryption

I'm having trouble decrypting a byte string using the openssl crate. As a heads up this is for the Cryptopals challenges, specifically set 2 problem 2. The text file has been encrypted using AES with CBC mode, but I guess a single block can be decrypted with ECB. I've already tried decrypting the e...
jdlm
1

votes
1

answer
54

Views

TypeError: decrypt() cannot be called after encrypt()

I am writing a simple code of AES encryption. I got stuck at a part where it says decrypt() cannot be called after encrypt(). I scrapped through the internet to find the solution, but unable to do so, maybe because of the lack of proper documentation examples. I tried changing the sequence these lin...
Sami
1

votes
1

answer
135

Views

OPENSSL ERROR : lib(6) func(101) reason(100) evp_enc.c

So I am working on AES encryption but this error keeps bugging me. ERROR: lib(6) func(101) reason(100) evp_enc.c I am encrypting my file with one program and decrypting it with another. The encryption was successful with this code. #include "stdafx.h" #include #include #include #include #include...
Zeeshan Nazar
1

votes
1

answer
633

Views

TinyOS: How can I convert uint_16 to two uint_8 integers (AES encryption)

I am using the Oscilloscope component to read sensor data. I'm sending this data to a basestation mote which is sending the data to a laptop. I want to implement AES encryption on the sensor data using the components provided here: http://tinyos.cvs.sourceforge.net/viewvc/tinyos/tinyos-2.x-contrib/...
user1754045
1

votes
1

answer
2.4k

Views

Java AES 256 CBC mode not working propery

Here's a ruby code to do AES in ECB and CBC: require 'openssl' require 'base64' def encrypt(data, key, cipher_type) aes = OpenSSL::Cipher::Cipher.new(cipher_type) key = key.ljust(32, "\0") aes.encrypt aes.key = key Base64.encode64(aes.update(data) + aes.final).tr("\n","") end puts encrypt("XJ5QJSVMK...
daniel
1

votes
2

answer
2.4k

Views

How to implement AES with IV attached to the encrypted message

So I've been trying to study AES encryption with c#. I'm a little stuck with IV's though, it's just I'm having a hard time trying to understand encryption and I'm hoping a little more explanation from other people might get me past this wall. Anyway, I found something regarding IV's and how to send...
gdubs
1

votes
2

answer
209

Views

Java display invalid characters?

I have written a program the performs the standard AES S-Box encryption. my problem is that when I encrypt the message it is supposed to write the text to a JTextArea, but it just shows a bunch of little square boxes and when I try to save it to a text document it just makes a bunch of question mar...
1

votes
1

answer
816

Views

Key length issue: AES encryption on phpseclib and decryption on PyCrypto

I am working on a data intensive project where I have been using PHP for fetching data and encrypting it using phpseclib. A chunk of the data has been encrypted in AES with the ECB mode -- however the key length is only 10. I am able to decrypt the data successfully. However, I need to use Python in...
arjun27
1

votes
1

answer
4.8k

Views

Using AES_DECRYPT with SELECT *

Is it possible to select all records and decrypt them using the asterisk with the AES_DECRYPT function? This is what I want to be able to do: SELECT AES_DECRYPT(*, SOMESTATICKEY) FROM some_table EDIT: I guess I should clarify my question since I know what I'm asking doesn't work. What I want to know...
Aaron
1

votes
1

answer
795

Views

encrypt file or string secure android

I'm currently stuck with the security in my app. My application records the GPS location of the user every 10 minutes and after 12 hours it sends the data to a server. I'm currently saving the location of the user in a *.txt file in the internal memory. Now, I need to secure this file so it can only...
1

votes
2

answer
18.3k

Views

AES Error: Given final block not properly padded

I need help with this error: Given final block not properly padded. As you can see from the title, I am working with AES. Here is the code of line where is error: byte[] decrypted = cipher.doFinal(bytes); Here is the full code: public class AESCrypt { private final Cipher cipher; private final Secre...
Zookey
1

votes
2

answer
114

Views

Is it safe to trim a decrypted string?

I am encrypting and decrypting a string using: $key = 'my key'; $data = 'my string'; $ivSize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($ivSize, MCRYPT_DEV_URANDOM); $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $data, MCRYPT_MODE_CBC, $iv); $decrypte...
Petah
1

votes
1

answer
898

Views

AES ofb decryption in C

I'm playing with AES encryption and I've encountered this problem. I found a code example somewhere around the net and I tried to play with it. (I'm using Gladman AES library) #include #include #include #include "aes.h" void encrypt(const char *fileIn, const char *fileOut, const unsigned char *ke...
J91321
1

votes
1

answer
2.7k

Views

How do I implement CBC mode?

My problem lies around the AES encryption algorithm and implementing an IV into the algorithm. I have the ECB version of AES working and I have thoroughly tested it. I'm trying to make it more secure by adding in an IV. I am looking to understand it better by knowing how the IV is implemented in the...
Repareman
1

votes
3

answer
2.2k

Views

Android AES decryption and data from iOS:javax.crypto.BadPaddingException: pad block corrupted

I tried to decrypt a backup on Android which is sent from iOS, and the exception javax.crypto.BadPaddingException: pad block corrupted is showed at method doFinal. public String decrypt(byte[] cipherText, SecretKey key, byte [] initialVector) throws Exception { Cipher cipher = Cipher.getInstance("A...
lht
1

votes
1

answer
1.8k

Views

Cryptography - AES and DES S-boxes

I am working on some cryptology revision exercises for university (in preparation for an exam) and this question has me puzzled: Most block cipher implementations treat S-boxes as lookup tables. DES uses 8 S-boxes which each take in 6 bits and output 4 bits. AES uses only one S-box which takes in 8...
zer0
1

votes
1

answer
1.4k

Views

Special characters contained in AES encryption output

I tried to find the list of possible characters that are contained in the encrypted output after AES 256 bit encryption. But, it seems like they are not on the internet? Mind to help? thanks.
MJL
1

votes
1

answer
1.4k

Views

string encoding error from delphi 7 to xe

i found on internet some source for crypt string and i saw that on delphi 7 the string is crypted and decrypted well, and when i try to do the same things with delphi xe2,xe3,xe4,xe5 the encryption end decryption fail with this error "invalid buffer size for decryption" i'm using aes.pas and eiaes....
user1931849
1

votes
3

answer
8k

Views

javax.crypto.IllegalBlockSizeException: last block incomplete in decryption

I'm working on a android project in which I have to decrypt string from a file in PHP server, encryption was done using PHP.(AES 128 algorithm) Encryption Code: function aes128Encrypt($key, $data) { $key = md5($key); return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC, str_repeat...
Karthik Sivam
1

votes
1

answer
3.1k

Views

AES Encryption with Bouncy Castle in Java

I have this simply AES encryption code: public static void main(String[] args) throws Exception { byte[] input = new byte[] { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, (byte)0x88, (byte)0x99, (byte)0xaa, (byte)0xbb, (byte)0xcc, (byte)0xdd, (byte)0xee, (byte)0xff }; byte[] keyByte...
user3077162
1

votes
3

answer
3.1k

Views

Java NIO + AES Encryption from Client to Server - ByteBuffer issue

I'm quite a newbie regarding encryption and NIO, I have the following code for client: String key1 = "1234567812345678"; byte[] key2 = key1.getBytes(); SecretKeySpec secret = new SecretKeySpec(key2, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, secret); byte[] e...
pelican_george
1

votes
1

answer
6k

Views

En-/decrypt “AES/ECB/PKCS5Padding” in Java

Could anyone tell me how I would decrypt data (using Java) that has been encrypted with this PHP function? PHP Code public function pad($data, $blocksize = 16) { $pad = $blocksize - (strlen($data) % $blocksize); return $data . str_repeat(chr($pad), $pad); } public function decryptECB($data) { return...
MeIsOlsson
1

votes
1

answer
9k

Views

AES Encryption Given Final Block Not Properly Padded

I'm trying to create a class that will allow me to encrypt and decrypt strings using the AES algorithm. I'm using the exception from http://aesencryption.net/#Java-aes-encryption-example but have modified the code to suit my needs. This is my Main.java: public class Main { public static void main(St...
Liam Potter
1

votes
3

answer
1.8k

Views

How to designate port as byte array in VHDL

Alright guys, sorry if this is a question that's been asked already, as I'm new enough to VHDL logic design to not know exactly how to term a particular concept. What I'm trying to do is implement the AES-256 algorithm in VHDL for FPGA use. I have a port named: entity rijndael is port ( input : in s...
blasthash
1

votes
3

answer
10k

Views

AES Decryption : javax.crypto.IllegalBlockSizeException: last block incomplete in decryption

I am trying to decrypt an encrypted data obtained from a web service using AES128 cryptography. following is the code i am using to achieve the same. But i always end up with the following exception: javax.crypto.IllegalBlockSizeException: last block incomplete in decryption public static String de...
iAviatorJose
1

votes
1

answer
1.4k

Views

Why am I getting type mismatch error Crypto++ AES

I am trying to implement the AES encryption algorithm in my program. I am testing speeds of different algorithms in Crypto++. I Have Blowfish and 3DES working, but I cannot get AES in there. The weird thing is when I separate the AES into it's own file, and run it, it works. So here is what DOES wor...
j.atec
1

votes
2

answer
497

Views

HMAC after encryption solution in Java

I want to encrypt a cookie and make sure the cookie is not modified so I use HMAC for encrypted cookie. There are a few ways to implement: 1. HMAC on encrypted cookie String encryptedCookie = AES ( cookie ) String mac = HMAC ( encryptedCookie ) -- Persist cookie with value: encryptedCookie + ":" + m...
Loc
1

votes
1

answer
425

Views

Encrypting a Large File of irregular size using AES algorithm

Currently in my project, i am required to encrypt a large file of variable size (around 1 to 1.5 GB) I am using the aes algorithm from the openssl project. But i am not using the entire library, but just a few functions which generate keys from "passwords" and use those keys to encrypt a fixed block...
1

votes
1

answer
3k

Views

attempting to decrypt using crypto-js and nodejs

I am communicated back and forth between a micro-controller and a nodejs tcp server. The micro-controller forms a json string with sensor data. The micro-controller then sends the json string to a WiFi module. The WiFi module then encrypts the data using AES256 with 32 character Hexadecimal chara...
dottedquad
1

votes
3

answer
328

Views

i hav an error in following code: invalid AES key length 9 bytes and java.lang.NullPointerException exception in main

Plz do tell me from where to study these encryptions, hashing; all in eclipse java i hav an error in following code: invalid AES key length 9 bytes and java.lang.NullPointerException exception in main. There is also an exception of java.security.InvalidKeyException. i have made my code in eclipse ke...
Shikha Atwal

View additional questions