encryption-symmetric

Can you do symmetric encryption on SAML attributes in SAML 2.0?

风格不统一 提交于 2019-12-08 04:20:37
Can you do symmetric encryption on SAML attributes in SAML 2.0? We can seem to do asymmetric. What are pros and cons? Ian SAML 2.0 utilizes XML Encryption (Sect 5.2.1 and 5.2.2). With that said, Sect 4.2 of the SAML 2.0 Conformance docs specifies you must support the following to be SAML 2.0 compliant: Block Encryption: TRIPLE DES, AES-128, AES-256. Key Transport: RSA-v1.5, RSA-OAEP In other words, SAML 2.0 mandates you use asymmetric keys. So, the "cons" will be that you are not SAML 2.0 compliant if you utilize symmetric encryption of SAML Attributes which will lead to interopability issues

javax.crypto.Cipher equivalent code in Nodejs Crypto Javascript

烈酒焚心 提交于 2019-12-06 13:01:00
问题 I'm trying to convert below java code into nodejs. public static String encrypt(String accessToken) throws Exception { Cipher cipher = Cipher.getInstance("AES"); String merchantKey = "11111111111111111111"; String st = StringUtils.substring(merchantKey, 0, 16); System.out.println(st); Key secretKey = new SecretKeySpec(st.getBytes(), "AES"); cipher.init(Cipher.ENCRYPT_MODE, secretKey); byte[] encryptedByte = cipher.doFinal(accessToken.getBytes()); // convert the byte to hex format StringBuffer

Is there two key symetric commutative encryption function?

ε祈祈猫儿з 提交于 2019-12-06 07:23:13
问题 I'm wondering if there is some strong (like AES or so.) encryption function that works like this: symetric 2 keys: plaintext -> 2keys ->ciphered text, however it must not matter order of keys, i.e Key1 (Key2 (plaintext)) == Key2 (Key1(plaintext)) e.g. "commutative" (also required for decryption - you need two keys, doesn't matter order) thanks 回答1: It's not a commutative encryption, but there are well-proven algorithms for secret sharing (note, this is not the same thing as "key agreement.")

How can I create a shared-secret voucher code system between 2 independent servers?

别说谁变了你拦得住时间么 提交于 2019-12-06 04:44:47
问题 Given this workflow: Server A User authenticates. User purchases randomly generated unique voucher code using shared secret to use an application on on server B. Server B User authenticates. User inputs voucher code. Server B validates code is legitimate using shared secret Server B grants access to the application. I need a way in PHP to implement the functions generateVoucherCode and validateVoucherCode as shown below: Server A $voucher = generateVoucherCode("someSharedSecret"); Server B

CipherOutputStream corrupting headers in Android

烈酒焚心 提交于 2019-12-05 07:12:29
问题 I'm using a simple CipherInput/OutputStream to try to encrypt/decrypt files in android. The problem I'm having is that it seems to be corrupting the first few bytes of the file but not the rest. Here's an example of an output from a simple text file: Original Text: "Test for Android cipher. The quick brown fox jumps over the lazy dog." Cycled through Encryption and Decryption: @ÍØJ­b¢çc°ÌHOšpher. The quick brown fox jumps over the the lazy dog. Here's my code: public static SecretKey

C# AES Rijndael - detecting invalid passwords

余生颓废 提交于 2019-12-05 02:29:04
I'm using Rijndael to encrypt some sensitive data in my program. When the user enters an incorrect password, most of the time a CryptographicException is thrown with the message "Padding is invalid and cannot be removed.". However, with very small probability, the CryptStream does not throw an exception with the wrong password, but instead gives back an incorrectly decrypted stream. In other words, it decrypts to garbage. Any idea how to detect/prevent this? The simplest way I can think of would be to put a "magic number" at the start of the message when encrypting, and check if it's still

Android decryption: Error while finalizing cipher

半世苍凉 提交于 2019-12-05 02:20:45
问题 I am using Android to encrypt and encrypt images sent between apps. The encryption works well but when the file arrives at the destination it will not decrypt. Now I have copied the file at the destination app and decrypted it successfully using 3rd-party software. The error I get is:"Error while finalizing cipher" at CipherInputStream (CipherInputStream.java:107) caused by IllegalBlockSizeException. The encryption & decryption code is below: public static String encrypt(String plainFile,

SSL + Additional Layer of Encryption

喜夏-厌秋 提交于 2019-12-05 01:01:25
问题 I'm wondering what to do in the case of a customer asking for a second layer of encryption on top of SSL? For example, I have an SSL tunnel, and the customer wants me to then use symmetric key encryption on data flowing through that tunnel. The symmetric key is session-based and sent from the server to the client over the original SSL tunnel. I am failing to see how this is more secure. If the SSL tunnel is compromised, then in theory, so is the symmetric key that is sent from the server to

Should one use Cryptographic message syntax (CMS) for this task?

梦想的初衷 提交于 2019-12-05 00:49:27
问题 I've the task to transfer small binary messages (1 or 2 kb long) between a desktop application and mobile devices. The messages should be encrypted asymmetrically (RSA for instance). From what I've learned one should use a hybrid cryptosystem for this kind of task: Generate random symmetric key Encrypt plain text with symmetric key (using AES for instance) Encrypt symmetric key with public key Transmit cipher text and encrypted symmetric key I'd like to not invent an own format for storing

Openssl AES 256 CBC Java Decrypt File with salt

旧城冷巷雨未停 提交于 2019-12-04 21:01:04
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 the: Salted__ + the salt encrypted. I get the error: Exception in thread "main" javax.crypto