encryption

How to use salsa20 counter nonce?

核能气质少年 提交于 2020-01-14 03:31:19
问题 I am not sure if I got it right: a counter of messages can be used as/instead of the nonce? I mean a message like this: Header(2bytes) | counter(8bytes) | Body(n bytes encrypted) | HMAC-SHA1 with counter = 1 (63 of the bits=0) is ok? I understand that I should never use the same key with the same nonce twice. What do I do when a new connection is started and counter starts from 1 again? 回答1: I understand that I should never use the same key with the same nonce twice. What do I do when a new

iPhone: Encrypt Nsstring using AES 128 and Decrypt

浪子不回头ぞ 提交于 2020-01-14 03:10:13
问题 I am new to Encryption/ Decryption. I want to encrypt a NSString variable value using key. Also I want to decrypt the encrypted data . I want to apply AES -128 Algorithm. Please suggest sample code or useful link. 回答1: I found this through a Google search on the terms aes nsstring site:stackoverflow.com : AES Encryption for an NSString on the iPhone 来源: https://stackoverflow.com/questions/2808568/iphone-encrypt-nsstring-using-aes-128-and-decrypt

Keystore operation failed with RSA sign and verify

筅森魡賤 提交于 2020-01-14 03:10:00
问题 I have difficulties to use RSA for signing and verifying. Below is part of my RSA class that I use. The methods init() , privateKey() and publicKey() work fine with encrypt() and decrypt() methods (last two not listed here), so I assume I made some mistake inside of my sign() method. Method verify() wasn't tested yet, because signing was unsuccessful, so I wasn't able to move further. Please take a look... My RSA class is: class RSA { private final static String ANDROID_KEY_STORE =

Keystore operation failed with RSA sign and verify

≡放荡痞女 提交于 2020-01-14 03:09:58
问题 I have difficulties to use RSA for signing and verifying. Below is part of my RSA class that I use. The methods init() , privateKey() and publicKey() work fine with encrypt() and decrypt() methods (last two not listed here), so I assume I made some mistake inside of my sign() method. Method verify() wasn't tested yet, because signing was unsuccessful, so I wasn't able to move further. Please take a look... My RSA class is: class RSA { private final static String ANDROID_KEY_STORE =

Problems writing a protocol on top of sockets in Java

北战南征 提交于 2020-01-14 03:09:27
问题 I'm writing a protocol on top of sockets, so I've decided to implement headers then send the information. So there is one thread per connection on the server which sits there reading in headers, then delegates off to methods to read in the rest of the information when it arrives. So essentially it looks like this: while ((length = inStream.read(buffer)) != -1) { dispatch(buffer, length); } So the dispatch method then decrypts the headers and delegates the method depending what is found in the

Problems writing a protocol on top of sockets in Java

北战南征 提交于 2020-01-14 03:09:02
问题 I'm writing a protocol on top of sockets, so I've decided to implement headers then send the information. So there is one thread per connection on the server which sits there reading in headers, then delegates off to methods to read in the rest of the information when it arrives. So essentially it looks like this: while ((length = inStream.read(buffer)) != -1) { dispatch(buffer, length); } So the dispatch method then decrypts the headers and delegates the method depending what is found in the

Java Security Class Couldn't be found

假装没事ソ 提交于 2020-01-14 01:08:15
问题 When launching my program the next error pops out java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.SunJCE_b which means this class is missing although I've found this class manually, works via jar/ide but doesn't works prefectly via service. Maybe I need to make a few modifications? but which? Thanks in advance 回答1: I don't know if this is relevant to your problem but I was experiencing the exact same behavior due to versions of the JCE Policy files I was using. Using

Secure data in VB.NET?

左心房为你撑大大i 提交于 2020-01-13 19:26:28
问题 My VB.NET application has a very important boolean variable. I need to be able to save it "somewhere" and read it back in the future (even if the application is closed). Currently, I store the variable as a .bin file somewhere. But I fear that the user can simply grab the file and do some magic to edit the value. I need to make this value completely unavailable from the user's eyes. Or at least, make it impossible to edit . What is the best way to hide such value? I managed to store the

How do I use libtomcrypt to import an RSA public key?

隐身守侯 提交于 2020-01-13 19:17:13
问题 I am experimenting with using libtomcrypt to do RSA-2048 bit encryption. My current objective is to import a public key from a file. This file was generated using OpenSSL with the command: $ openssl rsa -in private.pem -outform PEM -pubout -out public.pem So I believe my public key is in PKCS#1 padding and in OpenSSL's PEM format. I believe the function I need to use is rsa_import(), but that takes an in buffer, a length, and outputs an rsa_key pointer. Just to be clear, I believe what I need

Decrypttion fails on S/MIME enveloped message with OAEP key encryption?

*爱你&永不变心* 提交于 2020-01-13 19:13:10
问题 With Java and BouncyCastle I am able to decrypt lots of S/MIME enveloped messages. But when the key encryption algorithm is 1.2.840.113549.1.1.7 (id-RSAES-OAEP), the decryption fails (stack trace at the end of this question). The line where it happens: content = messageRecipientInfo.getContent(new JceKeyTransEnvelopedRecipient(pc).setProvider("BC")); Formerly I used that line to decrypt: content = messageRecipientInfo.getContent(givenCertRecipient); It's all the same. Any guess? EDIT * I now