block-cipher

Encryption in sending data from one app to another in android

喜你入骨 提交于 2020-04-16 02:27:23
问题 I want to send sensitive data from one app to another. I use Intent and send data via Bundle. Now, I am supposed to use an encryption algorithm to encrypt the data to send and parallelly the receiver app will decrypt the data. Which algorithm is best suited for the mobile platform? I have gone through RSA documents suggests that it is not suggested for long text encryption. I have seen the algorithm uses a random key generation method which will cause an issue in my case as both the app need

How to properly work with file upon encoding and decoding it?

女生的网名这么多〃 提交于 2019-12-25 08:21:34
问题 It doesn't matter how I exactly encrypt and decode files. I operate with file as a char massive , everything is almost fine, until I get file, which size is not divide to 8 bytes. Because I can encrypt and decode file each round 8 bytes, because of particular qualities of algorithm (size of block must be 64 bit). So then, for example, I face .jpg and tried simply add spaces to end of file, result file can't be opened ( ofc. with .txt files nothing bad happen). Is any way out here? If you want

Block ciphers, salt, AES, MySQL, and best practices around credential storage

*爱你&永不变心* 提交于 2019-12-20 01:46:42
问题 I have a situation where I must store a password, as I am building a system to connect to another system. This other system only allows for a single user account, and the only way to connect to it is via a password. A hash is not appropriate here. I must store the password in a way that I can retrieve it. Now, with the knowledge that this is not a perfect system, I am trying to limit damage should someone get access to the database somehow. As this database will need to be used by varying

Source and importance of nonce / IV for protocol using AES-GCM

不打扰是莪最后的温柔 提交于 2019-12-18 04:01:53
问题 I am making a protocol that uses packets (i.e., not a stream) encrypted with AES. I've decided on using GCM (based off CTR) because it provides integrated authentication and is part of the NSA's Suite B. The AES keys are negotiated using ECDH, where the public keys are signed by trusted contacts as a part of a web-of-trust using something like ECDSA. I believe that I need a 128-bit nonce / initialization vector for GCM because even though I'm using a 256 bit key for AES, it's always a 128 bit

Need help porting XTEA C++ code to PHP

我的梦境 提交于 2019-12-11 14:27:47
问题 I have some problem convert C++ code to PHP. The purpose is I need to communicate my application (build with C++) with web server (PHP ) using XTEA cipher to encrypt/decrypt the requested packet via XMLRPC. The original code I taken from some project Lode's Programming Interface and the code that I mean is this. some snippets: inline void xtea_encipher(unsigned int num_rounds, unsigned long* v, unsigned long* k) { unsigned long v0 = v[0], v1 = v[1]; unsigned long sum = 0, delta = 0x9E3779B9;

What is the default IV when encrypting with aes_256_cbc cipher?

自古美人都是妖i 提交于 2019-12-05 12:18:18
问题 I've generated a random 256 bit symmetric key, in a file, to use for encrypting some data using the OpenSSL command line which I need to decrypt later programmatically using the OpenSSL library. I'm not having success, and I think the problem might be in the initialization vector I'm using (or not using). I encrypt the data using this command: /usr/bin/openssl enc -aes-256-cbc -salt -in input_filename -out output_filename -pass file:keyfile I'm using the following call to initialize the

What is the default IV when encrypting with aes_256_cbc cipher?

余生颓废 提交于 2019-12-04 01:37:47
I've generated a random 256 bit symmetric key, in a file, to use for encrypting some data using the OpenSSL command line which I need to decrypt later programmatically using the OpenSSL library. I'm not having success, and I think the problem might be in the initialization vector I'm using (or not using). I encrypt the data using this command: /usr/bin/openssl enc -aes-256-cbc -salt -in input_filename -out output_filename -pass file:keyfile I'm using the following call to initialize the decrypting of the data: EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), nullptr, keyfile.data(), nullptr))

CTR mode use of Initial Vector(IV)

我与影子孤独终老i 提交于 2019-12-03 10:41:10
问题 from what I know, CTR mode doesn't use an Initial Vector. It just takes a counter, encrypts it with a given key and then XOR's the result with the plaintext in order to get the ciphertext. Other block cipher modes like CBC before doing the encryption they XOR the plaintext with an Initial Vector. So here is my problem. I have the following code in Java(using bouncycastle library): Cipher cipher = Cipher.getInstance("AES/CTR/PKCS5Padding", "BC"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[]

encrypt-decrypt single block with AES and Crypto++

十年热恋 提交于 2019-12-01 22:27:55
I need to encrypt single block of AES. I cant use any modes like CBC and other. Every example what i have seen use streaming modes. EDIT: ok, i did it in the next manner, but i really dislike this try. void dec(const byte *key, const byte* xblock, const byte *cipher, byte *plain) { AESDecryption d; try { const NameValuePairs &nvp = MakeParameters("", 0); d.UncheckedSetKey(key, 16, nvp); d.ProcessAndXorBlock(cipher, xblock, plain); } catch(...) {} } AES in ECB mode is identical to single block encryption, except that you can feed it multiple blocks. If you've got only CBC mode encryption

Block ciphers, salt, AES, MySQL, and best practices around credential storage

∥☆過路亽.° 提交于 2019-12-01 21:45:51
I have a situation where I must store a password, as I am building a system to connect to another system. This other system only allows for a single user account, and the only way to connect to it is via a password. A hash is not appropriate here. I must store the password in a way that I can retrieve it. Now, with the knowledge that this is not a perfect system, I am trying to limit damage should someone get access to the database somehow. As this database will need to be used by varying platforms, I have decided to use MySQL's own built-in encryption functions. This way, I don't need to