encryption

Order-independent ciphers

旧巷老猫 提交于 2020-01-12 17:39:11
问题 Is there exist a ciphering approach such that encrypting and decrypting order is arbitrary? Like using two padlocks on the same lock loop. That is, if there are two keys (or keypairs) K1, K2 , message M , and the cryptogram C is obtained as (for example) C=M*K1*K2 (where * denotes ciphering), then the message M can be retrieved in each of the following ways: 1) M=C*K1*K2 , 2) M=C*K2*K1 (here * denotes deciphering). Obviously, XOR is a trivial candidate. Do any cryptographically strong

How does using a salt make a password more secure if it is stored in the database?

假装没事ソ 提交于 2020-01-12 13:58:29
问题 I am learning Rails, at the moment, but the answer doesn't have to be Rails specific. So, as I understand it, a secure password system works like this: User creates password System encrypts password with an encryption algorithm (say SHA2). Store hash of encrypted password in database. Upon login attempt: User tries to login System creates hash of attempt with same encryption algorithm System compares hash of attempt with hash of password in the database. If match, they get let in. If not,

Embedded systems file encryption library

谁说我不能喝 提交于 2020-01-12 08:09:09
问题 I've got a project and a part of it is incorporating encryption into a FAT file system. The goal of the project is not the encryption, so I'm free to use open-source pre-done libraries. Ideally what I'm after is a C library which uses RSA, that already has the methods for computing keys and encrypting/decrypting files. 回答1: You might want to check out NaCl (pronounced as "salt"), especially since this is for an embedded system. It has CPU-specific tunings and doesn't require any dynamic

Using ruby to generate SHA512 crypt-style hashes formatted for /etc/shadow?

大憨熊 提交于 2020-01-12 07:41:19
问题 I want to generate SHA512 hashed passwords for inclusion directly into a /etc/shadow file for use with chef's user resource. Normally I'd go to the stdlib's Digest library for this, but it doesn't generate the hash in the right format: ruby-1.9.2-p136 :001 > require 'digest/sha2' => true ruby-1.9.2-p136 :002 > Digest::SHA512.hexdigest('test') => "ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff" The format that

Stopping decryption before EOF throws exception: Padding is invalid and cannot be removed

血红的双手。 提交于 2020-01-12 07:27:10
问题 This is the scenario we have: We have huge encrypted files, in the order of gigabytes that we can decrypt correctly if we read them until the end. The problem arises when we are reading and detect some flag in the file, then we stop reading and call reader.Close(), what happens is that a CryptographicException: "Padding is invalid and cannot be removed." is thrown. I have this small console app that reproduce this behavior, to test it just run it, it will create a file in your C:\ drive and

Stopping decryption before EOF throws exception: Padding is invalid and cannot be removed

左心房为你撑大大i 提交于 2020-01-12 07:27:06
问题 This is the scenario we have: We have huge encrypted files, in the order of gigabytes that we can decrypt correctly if we read them until the end. The problem arises when we are reading and detect some flag in the file, then we stop reading and call reader.Close(), what happens is that a CryptographicException: "Padding is invalid and cannot be removed." is thrown. I have this small console app that reproduce this behavior, to test it just run it, it will create a file in your C:\ drive and

How does ionCube work internally?

半城伤御伤魂 提交于 2020-01-12 05:57:22
问题 ionCube stores php files in encrypted format and it is installed as php extension but what i want to know is when I request the encrypted php file from non-encrypted php file how does php compiler executes it. Does it send the encrypted file to ionCube server and get the original file and compile that or there is something else. Means how the communication is going on between our server and ionCube. I guess it is through curl but i want to know how it works. 回答1: As you may have picked up on

AES Encryption Java -> PHP -> Java

左心房为你撑大大i 提交于 2020-01-12 05:49:05
问题 In my Android app I am communicating with a web service the data sent and responded are encrypted with AES encryption. So what I do is the following. I'm sending a base64 encoded AES encrypted JSON String to share.php Share.php will then decrypt this string and insert it into the database. After that the PHP will encrypt en encode the response. My Android application then needs to decode en decrypt this message. But the decryption of the PHP response is not going very well. This is my AES

How to encrypt in Java and decrypt in Android and iOS

非 Y 不嫁゛ 提交于 2020-01-12 04:04:37
问题 I have a Linux server running a Java-jar file that encrypts several files. The Android and iPhone App download that file and shall decrypt it. What algorithm I have to use to do so? I recognized that the algorithms I used in Java do not work in Android. What I did in Java was: private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec);

How to encrypt in Java and decrypt in Android and iOS

荒凉一梦 提交于 2020-01-12 04:04:19
问题 I have a Linux server running a Java-jar file that encrypts several files. The Android and iPhone App download that file and shall decrypt it. What algorithm I have to use to do so? I recognized that the algorithms I used in Java do not work in Android. What I did in Java was: private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec);