cryptography

Is Java security module KeyGenerator thread safe? If not then how to fix it?

本小妞迷上赌 提交于 2019-12-23 16:41:38
问题 I have a concurrent encryption/decryption program in which multiple AES128 keys are randomly generated concurrently by invoking the following code (written in scala, the Java version should be fairly similar): private def AESKeyGen: KeyGenerator = { val keyGen = KeyGenerator.getInstance("AES") keyGen.init(128) keyGen } def generateKey: SecretKey = this.synchronized { AESKeyGen.generateKey() } each key is use to encrypt a fixed byte array, then decrypt it by using AESEncrypt and AESDecrypt

How decrypt string in c# was encrypted in iOS using Rijndael

假装没事ソ 提交于 2019-12-23 16:40:49
问题 I'm trying to encrypt and decrypt the string using objective c and C#. both are working fine in native code, but when I was try to decrypt string in c# was encrypted in iOS. I get some error. This was the code I used in the objective c - (NSData *)AES256EncryptWithKey:(NSString *)key Data: (NSData *) data { char keyPtr[kCCKeySizeAES256+1]; // room for terminator (unused) bzero(keyPtr, sizeof(keyPtr)); // fill with zeroes (for padding) [key getCString:keyPtr maxLength:sizeof(keyPtr) encoding

Random 256bit key using SecRandomCopyBytes( ) in iOS

我是研究僧i 提交于 2019-12-23 15:07:59
问题 I have been using UUIDString as an encrption key for the files stored on my iPAD, but the security review done on my app by a third party suggested the following. With the launch of the application, a global database key is generated and stored in the keychain. During generation, the method UUIDString of the class NSUUID provided by the iOS is used. This function generates a random string composed of letters A to F, numbers and hyphens and unnecessarily restricts the key space, resulting in a

Using output from gpg --list-packets on a key to get the mpi values to generate s-expressions

孤人 提交于 2019-12-23 15:05:13
问题 I am trying to use gpg generated public keys to do encryption using libgcrypt. I used the list packets command on the key to get me the contents of the key and parsed the mpi values into an s-expression. So when I try to encode my session key with my public key I get the error "Odd hexadecimal numbers in S-expression"? I think list packets is maybe giving me hex numbers without the leading zero? If so what do I need to do to get me mpi values that I can use in libgcrypt? 回答1: After trial and

Is EAX crypto mode supported in the .NET framework?

╄→гoц情女王★ 提交于 2019-12-23 14:03:17
问题 Does anyone know if EAX mode is supported or how to use it? Here is an overview: http://en.wikipedia.org/wiki/EAX_mode 回答1: I don't believe that it is. And to make matters worse, the two building blocks of EAX - counter mode encryption and the CMAC authentication code - also do not seem to be supported by the standard .NET crypto libraries. At least, CTR mode isn't included in the CipherMode enumeration, and the only subclasses of KeyedHashAlgorithm (.NET's name for MACs) are HMAC and a

Is EAX crypto mode supported in the .NET framework?

感情迁移 提交于 2019-12-23 14:03:08
问题 Does anyone know if EAX mode is supported or how to use it? Here is an overview: http://en.wikipedia.org/wiki/EAX_mode 回答1: I don't believe that it is. And to make matters worse, the two building blocks of EAX - counter mode encryption and the CMAC authentication code - also do not seem to be supported by the standard .NET crypto libraries. At least, CTR mode isn't included in the CipherMode enumeration, and the only subclasses of KeyedHashAlgorithm (.NET's name for MACs) are HMAC and a

Is EAX crypto mode supported in the .NET framework?

筅森魡賤 提交于 2019-12-23 14:03:03
问题 Does anyone know if EAX mode is supported or how to use it? Here is an overview: http://en.wikipedia.org/wiki/EAX_mode 回答1: I don't believe that it is. And to make matters worse, the two building blocks of EAX - counter mode encryption and the CMAC authentication code - also do not seem to be supported by the standard .NET crypto libraries. At least, CTR mode isn't included in the CipherMode enumeration, and the only subclasses of KeyedHashAlgorithm (.NET's name for MACs) are HMAC and a

Implementation of PBEWithMD5AndDES in Ruby

跟風遠走 提交于 2019-12-23 13:03:30
问题 I'm trying to get a ruby implementation of an encryption lib that's apparently popular in the Java world -- PBEWithMD5AndDES Does anyone know how to use openssl or another open source gem to perform encryption/decryption that's compatible with this format? Updated: I used a gem chilkat to implement it but it is paid, i need an opensource solution. 回答1: You don't need to actually implement PBEWithMD5andDES assuming ruby has a DES implementation. What you need to implement is the key derivation

php mcrypt CBC mode encryption/decryption problem

大憨熊 提交于 2019-12-23 12:27:41
问题 I have a problem with CBC mode when I try to encrypt/decrypt some text using php's mcrypt extension. I've created a class to perform this operations, it works fine with other modes but CBC. The problem is as follow: I use the clear text Even in cryptography, silence is golden . I do the encryption part, no problem till this point. But each time I try to decrypt, I get something like this: 9��'t"�cryptography, silence is golden . As you can see, the first 8 characters of the text are wrong. I

How to use Shamir Secret Sharing Class in Crypto++

ε祈祈猫儿з 提交于 2019-12-23 11:11:47
问题 I tried to use the SecretSharing Class in Crypto++, but I couldn't make it work. Here is my code: using namespace CryptoPP; void secretSharing(){ AutoSeededRandomPool rng; SecretSharing shamir(rng, 4, 6); byte test[] = {'a', 'b', 'c', 'd'}; shamir.Put(test, 4); //shamir.MessageEnd(); //cout << shamir.TotalBytesRetrievable() <<endl; } After compile and run, I will get: ./main terminate called after throwing an instance of 'CryptoPP::BufferedTransformation::NoChannelSupport' what(): unknown: