encryption-symmetric

Symmetric Encryption between .NET and Java

时光毁灭记忆、已成空白 提交于 2019-12-23 17:28:00
问题 I am using a 3rd party platform to create a landing page, it is a business requirement that I use this particular platform. On their page I can encrypt data and send it to my server through a request parameter when calling a resource on my site. This is done through an AES Symmetric Encryption. I need to specify a password, salt (which must be a hex value) and an initialization vector (but be 16 characters). Their backend is a .NET platform. I know this because if I specify an IV longer than

Openssl AES 256 CBC Java Decrypt File with salt

本小妞迷上赌 提交于 2019-12-22 00:31:42
问题 I have been trying for several days to decrypt in java a message encrypted with openssl. The message was encrypted with the following command: openssl enc -e -aes-256-cbc -kfile $ file.key -in toto -out toto.enc. The file file.key contains the symmetric key of 256 bits. No salt has been specified in the command and yet the file begins with Salted__. Here is the class that I coded to try to decrypt the file but impossible to get anything even by removing the 16 characters of the file namely

How should I derive the key and initialization vector for my AES encrypted database entries?

久未见 提交于 2019-12-21 22:14:04
问题 I've built a CMS system to allow users to create and manage online forms on my client's intranet app. Of course some of the data handled by the forms may need to be encrypted e.g. if the system is used to build a form that handles salary specifics or whatever. So I'm using the AESManaged class to symmetrically encrypt this sort of data prior to it going into our application db. All is fine, but now, prior to release, I could do with a steer regarding the shared secret and salt . My original

AES 256 Encryption with PyCrypto using CBC mode - any weaknesses?

谁都会走 提交于 2019-12-21 20:43:46
问题 I have the following python script to encrypt/decrypt data using AES 256, could you please tell me if there's anything in the code that may make the encryption weak or if there's anything that I've not taken account of for AES 256 encryption using CBC mode? I've tested the script and it works fine, it is encrypting and decrypting data but just wanted a second opinion. Thanks. from Crypto.Cipher import AES from Crypto import Random BLOCK_SIZE = 32 INTERRUPT = u'\u0001' PAD = u'\u0000' def

Encrypting JWT security token supported algorithms

吃可爱长大的小学妹 提交于 2019-12-21 19:59:21
问题 I'm trying to sign and encode my JWt with this snippet: var claims = new Claim[] { new SomeClaimes() }; var scKey = Encoding.UTF8.GetBytes("SOME KEY"); var ecKey = Encoding.UTF8.GetBytes("SOME OTHER KEY"); var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(claims), SigningCredentials = new SigningCredentials( new SymmetricSecurityKey( scKey), SecurityAlgorithms.HmacSha512), EncryptingCredentials = new EncryptingCredentials( new SymmetricSecurityKey( ecKey), // I

Is this a secure encryption method

前提是你 提交于 2019-12-21 05:46:08
问题 I'm writing an application for Android that uses symmetric key encryption to protect sensitive data. As far as I can tell, Android only directly supports "PBEWithMD5AndDES". How secure is this algorithm? Also, I've included my code below (non-andriod). Is my code correctly encrypting the data? import java.io.UnsupportedEncodingException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java

java.security.InvalidKeyException: Key length not 128/192/256 bits

做~自己de王妃 提交于 2019-12-21 02:46:17
问题 I am new to Java and was trying to use Hybrid cryptography using AES-128 Symmetric encryption and then RSA-1024 Asymmetric encryption on the generated symmetric key. Can someone help why I am getting this exception. I have already followed the other posts, and downloaded the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files version 6 in the appropriate folder. Code snippet: import java.io.BufferedReader; import java.io.InputStreamReader; import java.security.Key;

C# to Java DES encryption

孤人 提交于 2019-12-19 05:02:03
问题 Trying to create java class which will encrypt and decrypt as like C# code in below. Below is my code for C#, I need to convert it to Java. Can someone help me how to do it? I've been doing this for almost 2 days yet can't find any solutions on how to convert it. I am new to crypto. Note - It seems C# code used ACME libraries. But in my java, i should not use ACME jar files. public static string EncryptBase64(string key, string clearText) { if (key.Length > 8) key = key.Substring(0, 8); byte[

C# to Java DES encryption

孤街浪徒 提交于 2019-12-19 05:01:49
问题 Trying to create java class which will encrypt and decrypt as like C# code in below. Below is my code for C#, I need to convert it to Java. Can someone help me how to do it? I've been doing this for almost 2 days yet can't find any solutions on how to convert it. I am new to crypto. Note - It seems C# code used ACME libraries. But in my java, i should not use ACME jar files. public static string EncryptBase64(string key, string clearText) { if (key.Length > 8) key = key.Substring(0, 8); byte[

BadPaddingException: invalid ciphertext

南楼画角 提交于 2019-12-18 13:50:11
问题 I would like some help as this is my first time in coding cryptography code. The encryption code appears to be working correctly, but the decryption throws an error. The error I get is: de.flexiprovider.api.exceptions.BadPaddingException: invalid ciphertext in the decrypt function towards the end of the code, which is marked as a comment // ERROR THROWN HERE! .............................. I have included all the imports, please excuse this, as thought it maybe relevant to the issue. Any help