des

Java PBEWithMD5AndDES

試著忘記壹切 提交于 2019-12-05 15:44:20
问题 I am using password based encryption. My initial thought was to use AES to encrypt the file which contains passwords. Turns out password based encryption does not support AES. It uses DES. AFAIK des is not secure. Is PBEWithMD5AndDES secure enough to thrust my data or should i look for another implementation? 回答1: It appears from your comments that what you would like to do is to encrypt a file which contains sensitive information, using a password-based encryption scheme, with a password

How do you use the crypt library in C for DES encryption? (setkey, encrypt, crypt, etc.)

一个人想着一个人 提交于 2019-12-05 10:40:23
问题 I need to do some simple DES encryption in C to interface with some old code. From what I understand you can use the "crypt" library for this, with the functions setkey, encrypt, crypt, etc. I have been messing with it and can't get it right. The example on the man page for setkey/encrypt is lacking. I want to get the same output as I would be able to get with some java code (see below). So let's say I have two character arrays in C. char *message = "hellothe"; char *key = "iamakey0"; Can

What is Go's equivalent to Python's crypt.crypt?

一世执手 提交于 2019-12-05 10:34:13
I am currently playing around with an example from the book Violent Python. You can see my implementation here I am now trying to implement the same script in Go to compare performance, note I am completely new to Go. Opening the file and iterating over the lines is fine, however I cannot figure out how to use the "crypto" library to hash the string in the same way as Python's crypt.crypt(str_to_hash, salt). I thought it maybe something like import "crypto/des" des.NewCipher([]byte("abcdefgh")) However, no cigar. Any help would be much appreciated as it'd be really interesting to compare Go's

How can I do an ISO 9797-1 MAC with triple DES in C#?

夙愿已清 提交于 2019-12-05 08:12:51
I've got a project which stipulates the following encryption rules for a 24 byte block of data. 1) Cryptography should be done using full triple DES MAC algorithm as defined in 9797-1 as MAC algorithm 3 with output transformation 3 without truncation and with DES in CBC mode as block cipher with ICV set to zeros. Last 8 bytes of encrypted data constitute the value we need. The program is saying the encryption done is wrong. Are there any other things I need to do to match the above spec? The data is a 24 byte value and output of the encryption should be 8 bytes, I guess (as per the spec). I am

Time to crack DES? Is it a task suitable for a script kiddie yet?

徘徊边缘 提交于 2019-12-05 06:15:18
Already understanding that AES is the encryption method of choice, should existing code that uses DES be re-written if the likely threat is on the level of script kiddies? (e.g. pkzip passwords can be cracked with free utilities by non-computer professionals, so is DES like that?) A quick google search seems to imply that even deprecated DES still requires a super computer and large quantity of time--or have times changed? In particular, this CAPTCHA library uses DES to encrypt the challenge string which is sent to the user in viewstate. DES is broken so far as storing sensitive data, and so I

Java Triple DES encryption with 2 different keys

时光总嘲笑我的痴心妄想 提交于 2019-12-04 21:50:58
I'm trying to encrypt data using triple DES with two different keys, so given the two keys k1 and k2 the cryptotext would be Ek1(Dk2(Ek1(plaintext))) where E is Encryption and D Decryption. I'm trying to simulate this using DES algorithm from java. Here is the code: public static void main(String[] args) { SecretKey k1 = generateDESkey(); SecretKey k2 = generateDESkey(); String firstEncryption = desEncryption("plaintext", k1); String decryption = desDecryption(firstEncryption, k2); String secondEncryption = desEncryption(decryption, k1); } public static SecretKey generateDESkey() {

Encrypt complete object with triple des

ⅰ亾dé卋堺 提交于 2019-12-04 20:43:42
I need to encrypt a complete java object. I am having a code which i have seen on internet which shows how to encrypt and decrypt text not the java object. So i was confused whether this is possible to encrypt complete java object. The code which i am using is below. package security; import java.security.spec.KeySpec; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESedeKeySpec; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; /** * This class defines methods for encrypting and decrypting using the Triple

perl CBC DES equivalent in java

佐手、 提交于 2019-12-04 20:34:02
This question was migrated from Information Security Stack Exchange because it can be answered on Stack Overflow. Migrated 5 years ago . We are migrating some code from perl to java/scala and we hit a roadblock. We're trying to figure out how to do this in Java/scala: use Crypt::CBC; $aesKey = "some key" $cipher = new Crypt::CBC($aesKey, "DES"); $encrypted = $cipher->encrypt("hello world"); print $encrypted // prints: Salted__�,%�8XL�/1�&�n;����쀍c $decrypted = $cipher->decrypt($encrypted); print $decrypted // prints: hello world I tried a few things in scala but didn't really get it right, for

encryption using provided key using DES with padding

拈花ヽ惹草 提交于 2019-12-04 19:13:41
I want to encrypt a frame using DES using a given key. The padding style I am using is PKCS5Padding. This pads the string with 02 02 if 2 bytes are to be added and with 03 03 03 if 3 bytes are to be added to make multiple of 8. But my requirement is to pad a string with my particular bytes. e.g if 2 bytes are to be added then 30 30 and 3 bytes are to be added then 30 30 30 (in hex 0's value is 30). Also, I must know how many padded bytes have been added. Which padding technique should I follow and how can I use it? Below is my code for encryption: byte[] keyValue = new byte[]{(byte) 0x30,

What does cipher.update do in java?

徘徊边缘 提交于 2019-12-04 18:33:36
I am implementing DES - CBC. I am confused as to what cipher.init , cipher.update and cipher.dofinal do. I just use init to set the key and dofinal to get the result. I don't use update. Is that correct? Also whats the difference to the result when using UTF-8 and ASCII encodings? Here is my code: byte[] ciphertext; Cipher enc = Cipher.getInstance("DES/CBC/PKCS5Padding"); enc.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "DES"), new IvParameterSpec(vector)); // Is this the complete ciphertext? ciphertext = encrypt.doFinal(data.getbytes("UTF-8")); The Javadoc for Cipher.doFinal(byte[]) says