3des

Mifare Ultralight C Authentication on Android

ぃ、小莉子 提交于 2019-12-11 00:57:25
问题 I have some Mifare Ultralight C tags for testing authentication. The first time I read it with the app NXP TagInfo, I could see the following info: (...) Page 04 - Page 27: FULL OF 0s **(empty tag)** Page 28: 00 00 -- -- Page 29: 00 00 -- -- Page 2A: 30 -- -- -- Page 2B: 00 -- -- -- Page 2C: 42 52 45 41 PAGE 2D: 4B 4D 45 49 PAGE 2E: 46 59 4F 55 PAGE 2F: 43 41 4E 21 The page 2C - 2F means that it had the default key "BREAKMEIFYOUCAN!" ( 425245414b4d454946594f5543414e21 ). Then I ran my Android

How to encrypt and decrypt files with bouncy castle (DES) in netbeans java?

﹥>﹥吖頭↗ 提交于 2019-12-08 13:02:16
问题 How can I encrypt and decrypt files (not strings) with bouncy castle (DESEngine)? I have searched before but could not find help. 回答1: Sorry, I have solved this by myself. Here is my code: Tesbouncy.java package tesbouncy; import org.bouncycastle.crypto.*; import org.bouncycastle.crypto.engines.*; import org.bouncycastle.crypto.modes.*; import org.bouncycastle.crypto.paddings.*; import org.bouncycastle.crypto.params.*; public class Tesbouncy { BlockCipher engine = new DESEngine(); public byte

PHP and C# 3DES Encryption

六眼飞鱼酱① 提交于 2019-12-08 07:54:50
问题 Need to convert the following function from PHP to C# (asp.net) function encrypt_3DES($message, $key){ // Se establece un IV por defecto $bytes = array(0,0,0,0,0,0,0,0); //byte [] IV = {0, 0, 0, 0, 0, 0, 0, 0} $iv = implode(array_map("chr", $bytes)); //PHP 4 >= 4.0.2 // Se cifra $ciphertext = mcrypt_encrypt(MCRYPT_3DES, $key, $message, MCRYPT_MODE_CBC, $iv); //PHP 4 >= 4.0.2 return $ciphertext; } Where $message is a string to encode and $key is the key The $key is base 64 encoded and it is

Why won't 3DES encrypt one block?

烂漫一生 提交于 2019-12-07 00:41:41
I'm trying to implement this question i asked in the past Securely Encrypt 64bits w/o per element overhead? In the immediate window i entered TripleDES.Create().LegalBlockSizes.First() and got {System.Security.Cryptography.KeySizes} MaxSize: 64 MinSize: 64 SkipSize: 0 64bits/8bits per byte is 8bytes. Exactly what length a long is. Anyways i run it through the code below and the exception throws. The length of the block is 16bytes. Not what i want to have... I would ask how to change it to 64bits but as the results say the min and max are both 64bits so why am i getting 128bits instead?? long

NoSuchProviderException when encrypting string with 3DES

狂风中的少年 提交于 2019-12-06 16:41:48
问题 I am new to Java. I followed this tutorial about Encryption and Decryption using 3DES algorithm. I have implemented like this: Created a class and placed the 3DES code provided in the above link. Called the encrypt method in the above link as below: String encryptedPassword = Encrypter.encrypt(edtText.getText().toString()); I am getting the exception in logcat as below: 05-02 15:19:10.804: W/System.err(4445): java.security.NoSuchProviderException: Provider not available: SunJCE 05-02 15:19:10

3DES encrypt result in PHP, JAVA and .NET produces different result from 3DES iOS

帅比萌擦擦* 提交于 2019-12-06 16:23:38
问题 I'm trying to upgrade my current app in iOS 8, to adapt to the new encryption SHA256 of Redsys / Sermpa. But I have problems in data encryption. In PHP, Java and .NET I get a result, completely different from iOS. I think the problem must be in the 3DES IOS CCCrypt. The PHP, JAVA and .NET code is a library, I can not alter that library. I have to make the result of encryption in iOS, is identical to right result encrypt in PHP, JAVA and .NET. Library Java Code: String secretCodeString =

Java Triple DES encryption with 2 different keys

六月ゝ 毕业季﹏ 提交于 2019-12-06 15:24:56
问题 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

Triple DES encryption on C# and PHP yields different results

大城市里の小女人 提交于 2019-12-06 07:53:32
问题 I'm writing a simple encryption system for logging in but I've got small issue. C# encrypt function: public static string EncryptString(string Message, string Passphrase) { byte[] Results; System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding(); // Step 1. We hash the passphrase using MD5 // We use the MD5 hash generator as the result is a 128 bit byte array // which is a valid length for the TripleDES encoder we use below MD5CryptoServiceProvider HashProvider = new

How to perform Triple DES calculations in Ruby in hexadecimal?

不问归期 提交于 2019-12-05 10:15:17
问题 I'm trying to do some triple DES encryption in Ruby. I'm trying to replicate the results from this page: http://da.nmilne.com/des.html I'm trying to replicate those result in Ruby. I suspect the problem is the key is supposed to be a string, but I need to pass in a Hexadecimal key. Either that or the string being encrypted is in the wrong format. Or maybe both. :-) require 'openssl' des = OpenSSL::Cipher::Cipher.new("des-ede-cbc") des.encrypt des.key="23232323232323234545454545454545" des

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