Questions tagged [aes]

1

votes
0

answer
44

Views

OpenSSL failed to allocate memory (NoMemoryError)

I am trying to decrypt a encrypted file. The encrypted file size is 0.97 GB. The decryption works perfectly fine for less size files. Please find the code i have for decryption. def do_encrypt encrypted_file = File.new(output_file, 'wb') encrypted_output = encrypt(File.open(file, 'rb')) encrypted_f...
1

votes
0

answer
242

Views

AES encryption in JAVA and decryption in C using openSSL causing issue

I am using below JAVA code to encrypt plain text, which will create cipher text, later decrypt this cipher text using Key ( which is generated via getSecretEncryptionKey().getEncoded() in JAVA File ) in C++ code. JAVA CODE: public byte[] encryptDecrypt(String jsonData, String publicKey) throws Excep...
Harshil Makwana
1

votes
0

answer
37

Views

Trigger maximum memory consumption with openssl

The code below, shows the average time of the 5 repetitions from openssl. Using the same idea, how can I get maximum memory consumption? #!/bin/sh SUM=0 for i in {1..5} do t=$((/usr/bin/time -f '%e' openssl enc -aes-128-ecb -K 1234567890 -in t -out g 1> /dev/null) 2>&1) SUM=`bc
Moser José
1

votes
1

answer
445

Views

how can encrypt AES 256 with cryptojs and decrypt in swift

I am trying to decrypt a string which is decrypted by cryptojs but not luck...I try to cryptoswift but still faileu var encrypted = CryptoJS.AES.encrypt('mystringforencryption', 'secret'); console.log(encrypted); console.log('encrypted.ciphertext'); console.log(encrypted.ciphertext); console.log(en...
user1820178
1

votes
0

answer
109

Views

Nodejs, Crypto: Encrypting multiple strings using same cipher

I am trying to encrypt multiple strings using same cipher with the code var iv = _crypto.randomBytes(16).slice(0, 12); var salt = _crypto.randomBytes(64); var key = _crypto.pbkdf2Sync(symmetricKey, salt, 2145, 32, 'sha512'); var cipher = _crypto.createCipheriv('aes-256-gcm', key,iv); var a = Buffer....
Neetu Soni
1

votes
1

answer
59

Views

How does middle rounds of AES encryption work in Go runtime?

I learn how AES`s implementation work in Go and I do not understand how middle rounds work while encrypt block in https://github.com/golang/go/blob/master/src/crypto/aes/block.go: // Middle rounds shuffle using tables. // Number of rounds is set by length of expanded key. nr := len(xk)/4 - 2 // - 2:...
sribin
1

votes
0

answer
277

Views

How to decode FPLY(Airplay Mirroring) DRM key

I'm developing AirPlay Mirroring Server App for mac(same as AirServer),But I don't know how to decoding the value of 'ekey' obtained from SETUP. Start Airplay Server //Init Roap Server [[NSNetService alloc] initWithDomain:@'local' type:@'_raop._tcp' name:@'' port:5000] //TXTRecordData 'txtvers...
innovator
1

votes
0

answer
91

Views

OpenSSL GCM Encryption using 16-byte IV

In reference to the github project: https://github.com/majek/openssl/blob/master/demos/evp/aesgcm.c And another StackOverflow question: Unable to set IV for aes gcm using openssl I'm attempting to use OpenSSL to perform GCM encryption with a 128-bit IV. The default IV is 96-bits, 12 bytes. When I se...
Chris
1

votes
2

answer
430

Views

AES Encryption with CryptoJS and PHP

I want to implement AES encryption using JavaScript. Used AES CBC Mode. I have managed to do it in PHP. It looks like: public function encrypt($value) { if (empty($value)) { return $value; } $value = Unicode::convertToUtf8($value, 'UTF-8'); if ($key = $this->getEncryptionKey()) { // Generates from k...
Shasha
1

votes
0

answer
38

Views

Encrypt body response on nginx

I'm trying to read the response file and encrypted with AES-cdc through nginx configuration. Something like that GET /encrypt/file.txt Response content_of_file_encrypted Is there a way to do it by nginx modules? or do I need to encrypt it with another tool before? Thanks
1

votes
0

answer
63

Views

send data encrypted from client side to server side to descrypt

I want to send from a client to a server data encrypt in order to decrypt in the server side. I encrypt in the client side '123456' in order to decrypt it in the server side by symmetric key. My code is the following one. Client code: public class Client { public static void main(String[] args) thro...
Nfernandez
1

votes
1

answer
480

Views

Encrypt and decrypt video file in JavaScript using CryptoJS

I would like to know how to encrypt and decrypt a video file with JavaScript. I have tried to do it with the Crypto-js library but I can't reproduce it after decrypting it. In the following code I try to take the input video to encrypt it and after decrypting it play it from HTML and download the fi...
asierta
1

votes
2

answer
271

Views

File encryption with AES-256-CBC vs Chunk encryption

First of all this is my first question here, I hope I can get you a clear idea of the problem and also help others that may face similar challenges! Also the title of the question was the shortest TL;DR I could get :-) So in order to give you a little context I'm basically designing a protocol that...
SerDom
1

votes
1

answer
294

Views

Is it safe to store an encryption key's MD5 hash?

Here is a scenario: a user enters a password an AES key is generated with password based key deriviation algorighm (takes a hundred ms or so) an MD5 of the generated key is exposed (stored somewhere) Would exposing MD5 of a generated key degrade its security somehow? If i understand correctly: in or...
Marius
1

votes
0

answer
54

Views

word file (doc, docx) damaged after encryption and decryption

i have tried the following code to encrypt and decrypt files using asp.net c# rijndael managed. all of the images notepad is encrypted and decrypted successfully, when it comes to doc or docx file it always showing damaged file when i tried to open. but if i click resolve this issue in microsoft wor...
Amam Mustofa
1

votes
0

answer
113

Views

JAVA AES ECB Encryption to Golang migration

I try to port a Java implementation of AES decryption to Golang. I need to decrypt data that is previously encrypted by the JAVA code using Golang. But so far I have no luck decrypting it. The Java code is: private static byte[] pad(final String password) { String key; for (key = password; key.lengt...
jroehl
1

votes
0

answer
117

Views

AES CBC with mysql and Python

I'm writing a little program that stores passwords in Python. I access to the DB with Mysqldb module. I want to encrypt the password with AES 256 with CBC. I'm trying to do this with SQL AES_ENCRYPT function. I set the cbc mode with: mysql> SET block_encryption_mode = 'aes-256-cbc'; So in python, I...
linofex
1

votes
0

answer
41

Views

Python decrypted text is different every time I decrypt

This is my code: # -*- coding: utf-8 -*- from Crypto.PublicKey import RSA from Crypto.Cipher import AES, PKCS1_OAEP import ast file_in = open('secret.bin', 'rb') private_key = RSA.import_key(open('private.pem').read()) enc_session_key, nonce, tag, ciphertext = \ [ file_in.read(x) for x in (private_k...
Michael Kirsch
1

votes
0

answer
28

Views

An inquiry about a h.264 derived stream protocol

First off, please forgive my complete lack of knowledge in this field. I got some time ago a couple of really cheap wifi ip cameras that I was hoping to use on my local network. Unfortunately, it turned out the manufacturer (zmodo) had introduced about a year ago their own streaming protocol and had...
Ivan
1

votes
0

answer
341

Views

AES-GCM for file encryption in Python

I am trying to use AES-GCM encryption for file encryption in python. I am using Cryptodome package and I know exactly what to do to perform encryption/decryption using encrypt_and_digest and decrypt_and_verify on a single plaintext string based on this example. Now, I am trying to encrypt and decry...
A23149577
1

votes
1

answer
660

Views

Input strings must be a multiple of 16 in length Python pycrypto

I'm trying to get into cryptography with python and got a question. Here is some code i did for learning and testing. #!/usr/bin/python3 import getpass from Crypto.Cipher import AES import hashlib import random import sys import os the_input = getpass.getpass('Enter password: ') theHash = hashlib.s...
zbious
1

votes
1

answer
262

Views

Openssl-aes-256-cbc encryption in iOS

I am working on Encryption,Decryption in swift OpenSSl AES-256-CBC. I have checked with many third- party libraries or pods i.e. CryptoSwift and many others. But I am always getting HMAc is Not valid from Php back end team. Where as in android they have done this: Following is my android method: pub...
puja
1

votes
0

answer
89

Views

Implementation of Python AES encryption/decryption code in Node JS

I am trying to implement the following Python code in NodeJS: from Cryptodome.Cipher import AES from functools import reduce from Cryptodome.Hash import SHA256 from Cryptodome import Random from binascii import b2a_hex def encrypt(text, *params): key = createKey(*params) iv = Random.new().read(16) t...
Alexander
1

votes
0

answer
249

Views

Cipher functions:OPENSSL_internal:BAD_DECRYPT in android Oreo

Android Oreo version 8 throws bad decrypt error in production. For other android versions code is working fine. Algorithm used is 'AES/CBC/PKCS5Padding'. public String decrypt(String _encryptedText, String _key, String _iv) throws InvalidKeyException, UnsupportedEncodingException, InvalidAlgorithmPa...
Tina
1

votes
1

answer
176

Views

AES encryption in NI LabView

How do I implement AES encryption and decryption in LabView and configure the following settings? Padding = PaddingMode.PKCS7 Mode = CipherMode.CBC Key Size = 128 Block Size = 128 I tried few option over here Igor Titov, AES Crypto Toolkit by Alab Technologies Tried to reach both parties to confirm...
HaBo
1

votes
0

answer
60

Views

Combining three states into one round in AES decryption

I am writing a program about AES encryption. To get a faster speed for AES encryption and decryption, three states of AES (sub byte, shift row, and mix column) can be combined into one round state. I can successfully combine these three states into one round in AES encryption (it can decrypt with...
MKM2
1

votes
0

answer
270

Views

Ionic Native - AES256 : Error occurred while performing decrypt AES256

I'm having an issue when I try to encrypt and decrypt a string. I'm using the Native plugin from Ionic. It might have installed it properly because the encryption works. Here is my code mostly copy pasted from the example on Ionic docs: this._Pass = '1234'; let encryptedData; this.aes.encrypt('123...
Charly
1

votes
0

answer
40

Views

Encryption Strength of a Base64 Expanded Key

I'm using AES to encrypt some data and I noticed a bug in the code that causes the Base64 encoded key to be used instead of the raw bytes. The key itself was 16 bytes and the Base64 encoded version is 24 bytes. I'm curious as to what impact this has on the security of the actual data. The encryption...
PetrolMan
1

votes
0

answer
55

Views

Trying to replicate Ethereum Keystore File using AES 128 CTR

I am trying to replicate the Ethereum Keystore File by performing the encryption using the pyscrypt and Crypto libraries in Python. I created an Ethereum Keystore file using MyEtherWallet. I took the values of SALT, IV, Private Key, Password from MyEtherWallet and hardcoded them into my program. fro...
Aditya Nalge
1

votes
0

answer
58

Views

Offline playback for encrypted HLS content in iOS

I am trying to implement online and offline video playback using HLS.I am able to play online encrypted HLS content, but i am facing issues with offline encrypted content. Can anyone guide, how to implement offline encrypted hls content play back in iOS.
kiran Kumar Katuru
1

votes
1

answer
62

Views

Java: Which mode is by default set in Javax Cipher class?

I am working on securing a chat application written in Java (it is downloaded from the internet, and now I want to secure it in order to learn). I have read the documentation, but I am unable to figure out which mode of encryption is set by default, if I don't explicitly put one. Is it ECB? If so, w...
Bab
1

votes
0

answer
100

Views

Desfire EV1 Communication - How to assign IV

AES-128 authentication process with Desfire EV1 cards goes like this: Get Application IDs: 90 6A 00 00 00 Select Application: 90 5A 00 00 03 10 00 00 00 (AID: 0x000010) Start Authentication with a key: 90 AA 00 00 01 02 00 (Key: 0x02) Card responses with a random 16 bytes array, lets call that RANDO...
Seckin Can
1

votes
0

answer
38

Views

Using AesManaged for CTR encryption

I'm trying to use this code https://gist.github.com/hanswolff/8809275 to make a CTR encryption/decryption. But when I encrypt and then decrypt i do not get my plain text back. I found several references to this code, and from the comments it seems to be a good implementation. So what am I doing wron...
ChristianB
1

votes
0

answer
36

Views

OpenSSL AES encryption with C++ produce different output issue

I have an issue while using Openssl in my C script where I have to encrypt the same string for a set number of loops, but even with the same iv and key, there are times when the encryption process produces different encrypted output than the rest of the other result, and it happens very frequently,...
Michael Adi G.
1

votes
0

answer
80

Views

gcm cipher mode in android

I use AES GCM cipher mode encryption, the code run without any problem in java but, at android exception error appears W/System.err: java.security.InvalidAlgorithmParameterException: unknown parameter type. W/System.err: at com.android.org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCip...
Sherif Awad
1

votes
1

answer
49

Views

'method-wrapper' object is not iterable in AES CTR pycrypto library

I'm trying to implement an encryption/decryption function in python2. This is the encryption scheme: However, I'm getting a 'method-wrapper' object is not iterable error in the AES CTR function of the pycrypto library This is the stacktrace: ----------------------------------------------------------...
Kek
1

votes
1

answer
214

Views

AES Decryption throws ValueError: Input strings must be a multiple of 16 in length

I got this current code of Github(@Cahlen Humphreys) and initially it wasn't working but after minor changes it runs for encryption, but decryption gives me the following error: return self.func(*args) File 'C:/Users/W4RL0RD/Desktop/websec.py', line 183, in cipher_open decrypt(filename,password) Fil...
Kumod Arya
1

votes
1

answer
47

Views

Cipher's doFinal() doesn't write bytes

This is my full code: import static java.nio.file.StandardOpenOption.READ; import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING; import static java.nio.file.StandardOpenOption.WRITE; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.file.Files; import java...
Flandia Yingman
1

votes
1

answer
145

Views

Can I decrypt GCM AES stream in Bouncy Castle using anything having SkippingCipher interface?

I have working AES GCM solution with Bouncy Castle (native API) exposing stream interface (CipherInputStream class). I know that GCM mode can be considered like CTR one so if I do not need authentication I should be able to decrypt stream from random place (if I know position) but what mode cipher c...
Roman Nikitchenko
1

votes
0

answer
46

Views

Cipher.doFinal trims data size when using AES/CBC/PKCS7

I'm trying to perform AES encryption on Android. I use the cipher.doFinal() method to encrypt the data. This works fine for smaller data, but fails when I use it on large data. When trying to encrypt large data e.g byte array with length 200k, my end result is a byte array with length of 70k. This i...
aarnaut

View additional questions