cryptography

What is the difference between a non-secure random number generator and a secure random number generator?

跟風遠走 提交于 2019-12-30 01:38:10
问题 As the title says: What is the difference between a non-secure random number generator and a secure random number generator? 回答1: No computationally feasible algorithm should: recover the seed, or predict the "next bit" for a secure random number generator. Example: a linear feedback shift register produces lots of random numbers out there, but given enough output, the seed can be discovered and all subsequent numbers predicted. 回答2: A secure random number should not be predictable even given

How can I get the same HMAC256-results in C# like in the PHP unit tests?

Deadly 提交于 2019-12-29 20:30:10
问题 I thought I would try and get the new Signed Request logic added to my facebook canvas application, to make this "easy" on myself I went to the facebook PHP sdk over at GitHub and took a look at the unit tests. My actual problem is that I cannot get the hash included in the request to match the hash I calculate using the application secret, and the data sent within the request. How this is meant to work is described at Facebook's authentication page. private string VALID_SIGNED_REQUEST =

Load ASN.1/DER encoded RSA keypair in C#

删除回忆录丶 提交于 2019-12-29 09:25:26
问题 I have DER encoded RSA keypair created in Crypto++, as well as cipher. They are Base64Encoded string. I first decode the data from Base64 to byte array, but I am not sure how to load them into RSACryptoServiceProvider . static void Main() { string pbkeystr = "mypublickey"; string pvkeystr = "myprivatekey"; string cipherstr = "mycipher"; byte[] pbkey = Convert.FromBase64String(pbkeystr); byte[] pvkey = Convert.FromBase64String(pvkeystr); byte[] cipher = Convert.FromBase64String(cipherstr);

Java: Patching client side security policy from applet for AES256

天涯浪子 提交于 2019-12-29 06:29:26
问题 I require AES256 encryption/decryption in a commercial web application. Currently everything is good with a key size of 128. This is not satisfactory cryptographically so my problem is how best to get round this issue without requiring the user to install anything manually. I have the unlimited jurisdiction jar files from Oracle but I have no idea if replacing these in the user's JRE/lib/security directory will be compatible with older versions. Obviously I don't want to corrupt the user's

What is the key size for PBEWithMD5AndTripleDES?

我与影子孤独终老i 提交于 2019-12-29 06:19:27
问题 I am trying to replace PBEWithMD5AndDES with PBEWithMD5AndTripleDES in existing code. So far, I am using the same passphrase that I was using before, and receiving this Exception: java.security.InvalidKeyException: Illegal key size I looked online and saw that DES uses a 64 bit key and TripleDES uses a 128 bit key. I am not clear on the details of how my passphrase is used to generate a key, and not sure where to look to understand this fully. My passphrase is 260 characters long. I tried

CCCrypt decrypting in AES CBC works even without IV

此生再无相见时 提交于 2019-12-29 05:25:17
问题 I have a confusing problem, where decrypting a file which was encrypted using CCCrypt's AES-CBC mode with a randomized, 16byte IV produces the exact same output whether I pass in the same correct IV used for encryption or none at all. What I expect: using a NULL IV for decrypting should not result in a correct decryption. What I observe: using a NULL IV results in the same result as with the IV used for encryption. Below for sake of completeness, here's the important code snippets, iv is

Using an RSA Public Key to decrypt a string that was encrypted using RSA Private Key

ぐ巨炮叔叔 提交于 2019-12-29 03:30:07
问题 I know the main answer I am likely to get is why the hell would you want to do that?! Unfortunately despite my protests I have to do it, even though I know it makes little sense. I have functions written in .Net to decrypt using a private key, encrypt using a public key. I also RSA sign and verify and have a reasonable understanding of how this all work I think. I am now being sent a value that is RSA encrypted using a private key which I am supposed to derive a usable value by decrypting

Recommended Python cryptographic module?

人走茶凉 提交于 2019-12-29 02:54:14
问题 I've been exploring what cryptographic modules are available to Python, and I've found 3: ezPyCrypt, yawPyCrypt and KeyCzar (which actually supports a few languages, but Python is included amongst them). The first two rely on the PyCrypto module. Are there choices I am missing? Is there a clear front-runner for ease and features or does it simply come down to a manner of one's comfort level? I'm currently leaning towards KeyCzar, with ezPyCrypt close behind. I would be using the library for

Crypto library suitable for Objective-C

随声附和 提交于 2019-12-28 12:49:10
问题 I'm looking for a crypto library to use with Objective-C code. There is a C++ library which is too big for my needs. It's 20 mb when compiled. I think a C library would be perfect to use with Objective-C. Here is my needs for this library: AES (Rijndael) CFB Mode SHA1 SHA256 HMAC-SHA1 HMAC-SHA256 PBKDF2 Your help will be greatly appreciated. 回答1: I link against OpenSSL for cryptography in my Objective-C projects. If you're using OS X, this is already installed on every user's machine. There's

Saving SecKeyRef device generated public/private key pair on disk

╄→尐↘猪︶ㄣ 提交于 2019-12-28 10:44:23
问题 I've generated an RSA symmetric key pair on a device using SecKeyGeneratePair() on a device. I have SecKeyRef struct pointers for each key. So, how do I save a SecKeyRef to disk? Or even transmit it (I also imagine there are issues with correct encoding too)? Apple's 'Certificate, Key, and Trust Services' Guide notes You can send your public key to anyone, who can then use it to encrypt data. I'd like to save the private key especially; so I can use it on deployed devices to decrypt data