cryptography

Generating a public/private key pair using an initial key

不羁的心 提交于 2019-12-24 00:32:44
问题 I'm looking for a method that enables a user to generate a pair of public/private keys using an initial key provided to him/her. I don't know if this is called hierarchical key generation or multilevel key generation or something else. It's not important for the higher level key to be able to decrypt the data of the lower level I just need the pair to be be generated using another key. I have a seen some articles but they're all just theoretical. Is there a way to achieve this for RSA? 回答1:

Elliptic curve addition in Jacobian coordinates

╄→尐↘猪︶ㄣ 提交于 2019-12-23 20:24:53
问题 I try to add two points on an elliptic curve over a prime field, converting these points from affine/to-affine coordinates, but do not manage to get a correct result (the curve I am testing has a=0). Anyone can see what's wrong? // From Affine BigInteger X1=P.x; BigInteger Y1=P.y; BigInteger Z1=BigInteger.ONE; BigInteger X2=Q.x; BigInteger Y2=Q.y; BigInteger Z2=BigInteger.ONE; // Point addition in Jacobian coordinates for a=0 // see http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0

Cross-platform cross-language cross-everything actually deterministic random number generator

北城余情 提交于 2019-12-23 20:00:24
问题 I'm looking for an algorithm to generate random numbers from a given seed but with the particular requirement that it will always generate the same sequence of number regardless of the underlying computer architecture or language implementation. I already know of Mersenne Twister, however, the numbers it generates differ when using different implementations (i.e. C MT vs Javascript MT). Do algorithms with this property exist? Also, I don't need a state-of-the-art RNG, I don't even need it to

Cryptographic failure while signing assembly '<assemblyname>.dll' – 'Bad Version of Provider'

痞子三分冷 提交于 2019-12-23 19:38:07
问题 I purchased an authenticode certificate from a well known provider. Now I want to strong name an assembly and later on digitally sign it. This is what I've done so far: Extracted public key from pfx by running sn.exe -p keypair.pfx key.snk Checked both "Sign the assembly" and "Delay sign only" checkboxes on project properties signing tab Provided key.snk as keyfile to sign with Extracted public key token by running sn.exe -tP key.snk Disabled strong name verification on my devbox by running

Strange behavior of crypto_box_easy and crypto_box_open_easy. Decrypt without private key?

随声附和 提交于 2019-12-23 19:20:42
问题 I have tested Public-key-cryptography by libsodium and came across a strange behavior. The encrypted message is decrypted without the private key. Example from official site libsodium #include "sodium.h" #define MESSAGE "test" #define MESSAGE_LEN 4 #define CIPHERTEXT_LEN (crypto_box_MACBYTES + MESSAGE_LEN) static bool TestSodium() { unsigned char alice_publickey[crypto_box_PUBLICKEYBYTES]; unsigned char alice_secretkey[crypto_box_SECRETKEYBYTES]; crypto_box_keypair(alice_publickey, alice

Crypto++ AES Decrypt how to?

痞子三分冷 提交于 2019-12-23 18:59:55
问题 There are next to no noob guides to crypto++ out there. Or none that I've found anyway. What I want to do is decrypt an array of uchars I generate with another AES encrypter. Where would I start? I have the library built and linking grand. Do I need to set anything up or do I just call a function on my array (and if so what function) ? I'd really appreshiate some help from someone who knows this stuff. Thanks 回答1: I wouldn't say I "know my stuff" too much about this, but here's some test code

Reproducing JS PBKDF2 Hash in C#

感情迁移 提交于 2019-12-23 17:27:02
问题 I had to implement some new security features for an Existing Database. They used to hash passwords on the side of the client with a salt from the DB. They used this code to hash the passwords before sending them to the server: var hash = CryptoJS.PBKDF2(password, USER_SALT, { keySize: 4, iterations: 1000 }); Now as you can already guess, this is highly insecure, cause an attacker gets the PW as if it was sent in plain text if the user gets the Salt from the server and the hasing is done

How do I decrypt data encrypted by Ruby's `symmetric-encryption` gem in another language?

房东的猫 提交于 2019-12-23 16:56:13
问题 I want to access data in a database created by Rails for use by non-Ruby code. Some fields use attr_encrypted accessors, and the library in use is the symmetric-encryption gem. I consistently get a "wrong final block length" error if I try to decrypt the data with, e.g., the NodeJS crypto library. I suspect this has to do either with character encoding or with padding, but I can't figure it out based on the docs. As an experiment, I tried decrypting data from symmetric-encryption in Ruby's

C# Rijndael decryption returns extra question mark character

泄露秘密 提交于 2019-12-23 16:46:10
问题 I am organizing some very basic symmetric encryption/decryption codes in a class for future use. I am able to encrypt and decrypt successfully... only with a small problem. Here is my code that reads in from a stream and en/decrypt to another stream: public void Encrypt(Stream input, Stream output) { byte[] key = Encoding.UTF8.GetBytes(_pw); byte[] iv = Encoding.UTF8.GetBytes(GenerateInitVector()); RijndaelManaged rm = new RijndaelManaged(); CryptoStream cs = new CryptoStream( output, rm

floating point number from crypto.randomBytes() in javascript

懵懂的女人 提交于 2019-12-23 16:41:47
问题 How do I convert the array of bytes returned from crypto.randomBytes into a to a floating point number? I'm writing a small replacement for Math.random() 回答1: Suppose you have a series of bytes randomly selected with uniform distribution over [0, 256). Take seven of those bytes, say a 0 , a 1 ,… a 6 . Calculate (((((((a 6 % 32)/32 + a 5 )/256 + a 4 )/256 + a 3 )/256 + a 2 )/256 + a 1 )/256 + a 0 )/256. Explanation: a 6 % 32 denotes the residue of a 6 modulo 32. This takes five bits of a 6 .