cryptography

Reading digital certificate from the file

梦想的初衷 提交于 2020-01-16 13:02:22
问题 I signed a file using Signtool.exe and now I am trying to load the certificate attached to the file using the following method var cert = X509Certificate2.CreateFromSignedFile(filePath); but his line throws an error "Cannot find the requested object.". When I try reading the certificate from a microsoft signed dll e.g. EntityFramework.dll , it works without any problems. I thought it could be because I don't have the certificate in the Trusted Store but even after adding it there, it

Security review of an authenticated Diffie Hellman variant

我的未来我决定 提交于 2020-01-16 07:04:22
问题 EDIT I'm still hoping for some advice on this, i tried to clarify my intentions... When i came upon device pairing in my mobile communication framework i studied a lot of papers on this topic and and also got some input from previous questions here. But, i didn't find a ready to implement protocol solution - so i invented a derivate and as i'm no crypto geek i'm not sure about the security caveats of the final solution: The main questions are Is SHA256 sufficient as a commit function? Is the

program linked with lcrypto is many times slower than openssl command

让人想犯罪 __ 提交于 2020-01-16 05:23:07
问题 I have a simple C program for aes256 encryption. It is linked with openssl library ( -lcrypto ). The core of the program are following few lines: AES_set_encrypt_key(key32 ,256 ,&aes_ks3); while( len = fread( buf ,1 ,4096, fp) ){ if( 4096 != len ) break; AES_cbc_encrypt(buf ,buf ,len ,&aes_ks3 ,iv ,AES_ENCRYPT); fwrite(buf ,1 ,len ,wfp); } AES_cbc_encrypt(buf ,buf ,len+padding_len ,&aes_ks3, iv,AES_ENCRYPT); fwrite(buf ,1 ,len+padding_len ,wfp); I am only using standard openssl library

RSA function generates public key (e) always to 17

我们两清 提交于 2020-01-16 04:35:20
问题 I've been working on a project based on RSA key exchange and I have used Crypto++ Library. I followed the guidelines in https://www.cryptopp.com/wiki/Raw_RSA and my project works fine. However, I noticed that the public key is always fixed to 17 10 = 11 16 and when I looked in the rsa.cpp in Crypto++ that public key is fixed! Again, my project works fine, but I just want to know why.. 回答1: I noticed that the public key is always fixed to 17 10 = 11 16 and when I looked in the rsa.cpp in

SecKeyRawVerify verifies on mac but fails with -9809 on iOS

北战南征 提交于 2020-01-16 03:50:07
问题 I need to digitally sign on mac some data and then verify it on iOS. So I generated RSA keypair and certificate for public key in DER format with open ssl (tried generation with SecKeyGeneratePair but then it is harder to import Public key to iOS and SecKeyRawVerify still doesn't work with the same result), and signed my data on Mac app. Then if I verify this data on iOS verification fails with -9809 error code, but if execute the same code on mac verification succeeds. Here is my code for

AES and its cipher modes

不问归期 提交于 2020-01-16 03:41:29
问题 I was trying encryption/decryption with AES then I tried the CBC & ECB modes I got the same encrypted output from all three ! is this how it goes? it's may not be wrong but I just don't know what to expect . and what's the point of having modes if they all produce the same cipher ? is it time or performance complexity ? can you explain the difference between AES and its cipher modes ? what's the default cipher mode ? or if you can give me any references cuz MSDN is not clear enough thank you

Why doesn't my implementation of ElGamal work for long text strings?

元气小坏坏 提交于 2020-01-15 11:10:09
问题 I'm playing with the El Gamal cryptosystem, and my goal is to be able to encipher and decipher long sequences of text. El Gamal requires the plaintext to be an integer. I have turned my string into a byte[] using the .getBytes() method for Strings, and then created a BigInteger out of the byte[]. After encryption/decryption, I turn the BigInteger into a byte[] using the .toByteArray() method for BigIntegers, and then create a new String object from the byte[]. I am using a 1035 bit key, and

Trying to get AES encryption of a string in node.js to match encrypted value in .net

旧巷老猫 提交于 2020-01-15 07:30:41
问题 I'm trying to encrypt a value in node.js that I can decrypt in .net. I've been given the code that they use on the .net side of things for encrypting a value and i'm trying to achieve the same encrypted value in my node.js script. I'm definitely not an encryption buff so please help me figure out where i'm going wrong. My node.js encrypted value is not matching that of the .net encrypted value, and my node.js encrypted value is actually not returning the same value every time I run the script

PKI verification across Java and Python

浪子不回头ぞ 提交于 2020-01-15 06:29:14
问题 I am trying to implement a PKI verification scheme, where a message string is signed with a private key on server, the signature is stored on the client along with the message string. The client then verifies the signature using a public key. The restrictions of my environment are, the server is Google App Engine and the client is a Java program. I have played with Java-only and Python-only solutions of PKI verification and got them to work, however when doing one operation in Python and

Is rapidly creating BouncyCastle SecureRandom instances problematic?

半城伤御伤魂 提交于 2020-01-15 02:29:21
问题 As noted at Random number generator only generating one random number, it's generally incorrect to create a new instance of System.Random every time that you need another random number, since System.Random is seeded based upon the clock and so multiple instances created in the same tick will yield identical random numbers. As such, one common practice (at least in single-threaded applications) is to create a single instance of Random stored in a static field that is used for all random number