Questions tagged [aes]

1

votes
1

answer
25

Views

AES - How do I write Inverse Sub Bytes in C++?

How do I write Inverse Sub Bytes for AES Decryption in C++? I only found Sub Bytes for AES Encryption, which is shown below. void SubBytes(unsigned char* state) { for(int i=0, i
jan
0

votes
0

answer
27

Views

How to decrypt AES cipher in Java?

I got encrypted text and key which can be successfully decrypted using this python code. https://stackoverflow.com/a/21928790/11028953 PYTHON CODE which decrypts the cipher: import base64 import hashlib from Crypto import Random from Crypto.Cipher import AES class AESCipher(object): def __init__(se...
Mart123
1

votes
2

answer
99

Views

Why is Ruby base64 encoded string different from all other base64 encoded strings?

For end-to-end encrypted communication between a client and a server, I am implementing an encryption/decryption algorithm. However, they (encryption/decryption and base64 encoding/decoding) work fine only when it's in Ruby. But the actual problem I see is with the Base64 encoding of Ruby. For examp...
Bhavesh Kshatriya
1

votes
1

answer
261

Views

1 KEY = AES + PBKDF2 + HMAC

My algorithm template this: ... Mkey = '123' // from Master Key KdfKey = SHA512(Mkey) // from PBKDF2 password KdfSalt = SHA256(AesIV + KdfKey) // from PBKDF2 salt Pbkdf2 = PBKDF2(KdfKey, KdfSalt, 64 + 32) // '64+32'=OutputLen, Iteration is user selected AesKey = sublast(Pbkdf2, 32) // AES 256 bit CB...
CorbySoft
1

votes
1

answer
275

Views

Use SEE SQlite Encryption Extension in C#

I'm creating an SQLite database with ADO.NET usyng System.Data.SQLite, now I need to encrypt it using AES-256. I have access to SEE (SQLite Encryption Extension) and am looking on how to use it along with System.Data.SQLite. Previously we used Devart to handle the extension and encrypt the database...
roma8716
1

votes
0

answer
56

Views

How to encrypt String with AES in java to get the same result of php Encrypt?

This is my first time, that I encrypt Strings. I have tested the php and java encrypt using AES. Its work fine but the Question, what to do in java Code that I get the same Result of php ? I have used the php code without making any change. But my Java needs change that I get the same result. im...
user9212972
1

votes
1

answer
274

Views

Using JSON with AES is throwing javax.crypto.IllegalBlockSizeException

When I encrypt with AES/CBC/PKCS5Padding a normal String there is no problem. When I use a JSON String which contains typical JSON type data and it throws an exception when doing Decryption: Full Exception: Exception in thread 'main' javax.crypto.IllegalBlockSizeException: Input length must be multi...
Felix Gaebler
1

votes
0

answer
280

Views

CryptoJS AES Decryption Not Giving original ZIP/EPUB file in react native

I am using CryptoJS to encrypt my epub (or zip) file and decrypt it. I am using react native to create the app. But I don't know why the decrypted file is not the original epub file. The error while opening the decrypted epub file is: Error in opening zip file. And I am using react-native-fetch-blob...
Sagaryal
1

votes
0

answer
994

Views

CryptoJS AES Encryption in React Native

How do I encrypt and decrypt an epub/zip file in react native? I am using react-native-fetch-blob for file streaming. I have also posted this question previously in detail with no result. Here is the link if you need. Also the link of CryptoJS. I was reading the epub/zip file in base64 format which...
Sagaryal
1

votes
0

answer
307

Views

error while decrypting with RSA

For the first the time, I'm working the Android Keystore. I need to save the data with android keystore. After exploring the documentation and few tutorial over the internet. I came up with a java class which will handle the Keystore operations for Post-M and Pre-M android devices which is as below:...
Dinesh M
1

votes
0

answer
305

Views

encrypt file in php decrypt in android using aes

I want to encrypt a zip file in PHP and decrypt it in the android PHP script work's fine but android decryption doesn't work correctly also i'm working with volley this is my PHP script: include 'MCrypt.php'; $base = base64_encode(file_get_contents('mojudati-be-nameh-az-ma- behtaran.zip')); $mcry...
mahdi navidi
1

votes
0

answer
509

Views

Streaming H264 encoded AES Encrypted video over VLC using SDP file

I am trying to Play a H264 encoded AES-128 encrypted video on VLC player which was received by rtp, How to add a Encryption Key in SDP file . Server : gst-launch-1.0 videotestsrc ! 'video/x-raw,width=640,height=480,framerate=30/1' ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=s...
Datta
1

votes
0

answer
237

Views

showing digital envelope routines:EVP_DecryptFinal_ex:wrong final block length

While I am trying to decrypt AES encrypted video file by using the code given below, // generate random passphrase binary data var r_pass = crypto.randomBytes(12); // convert passphrase to base64 format var key = r_pass.toString('base64'); console.log('password:',key) exports.encryptFile = functi...
Prajeesh Prakash
1

votes
1

answer
85

Views

Separating Python bytes array starting on \x with regEx

Trying to Encrypt every 26 char length block like so, first turn it into an array of bytes then use regex to find every \x in the bytearray and afterwards encrypt it with AES. import re import base64 from Crypto.Cipher import AES from Crypto.Random import get_random_bytes key=get_random_bytes(16)...
LexByte
1

votes
0

answer
239

Views

Powershell - using machine-agnostic SecureString via AES Key - password not decrypting correctly

I need to create a portable set of key files and password files to allow multiple Windows-based systems to use the same set of credentials. I am using this script to create the key file and the encrypted password file: #========================================================================== # #...
Walkabout Tigger
1

votes
0

answer
191

Views

STM32L082xx AES128 CBC Hardware Encryption using ST's HAL

Decryption is not working as intended on STM32L082xx. Here is my attempt: I'm using all zeros as iv and key and all 0x42 for plain text. If I do the same thing in python I get a different result: I get {0x7c,0xA5,0xDA,0xBF,0x97,0x18....} Note I'm using key and IV which are not influenced by endian...
Flying Swissman
1

votes
1

answer
466

Views

Convert string to byte in crypto++

I am using the AES cipher with Crypto++. I have a key that recorded in the file during encryption. I extract key from file to string and try to use for decrypt. Is there any way i can convert the string that contains the key string s1 to CryptoPP::byte? There fragment of code. encoded.clear(); Strin...
Ghost Ninja
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

View additional questions