cryptography

Key Strengthening. Am I Doing It Right?

梦想的初衷 提交于 2019-12-23 10:24:05
问题 I am writing a class to hash passwords which implements Key Stretching by using the System.Security.Cryptography.Rfc2898DeriveBytes class to generate the keys used to compute the hash value. The code essentially does this: // Higher iterations value results in better key strength var db = new Rfc2898DeriveBytes(password + salt + secretKeyFromConfigFile, saltAsBytes, iterations); byte[] hashKey = db.GetBytes(64); // 64 bytes is the recommended size for the HMACSHA512 class var sha512 = new

How to verify a signed file in python

ⅰ亾dé卋堺 提交于 2019-12-23 09:32:28
问题 Background I have signed a file using openssl SHA256 and a private key as follows: with subprocess.Popen( # Pipe the signature to openssl to convert it from raw binary encoding to base64 encoding. # This will prevent any potential corruption due to line ending conversions, and also allows # a human to read and copy the signature (e.g. for manual verification). 'openssl dgst -sha256 -sign private.key sign_me.zip | openssl base64 > signature.sha256', stdout=subprocess.PIPE, stderr=subprocess

Implementing MongoDB SASL Authentication in cl-mongo

杀马特。学长 韩版系。学妹 提交于 2019-12-23 08:53:22
问题 I've forked the cl-mongo (common lisp MongoDB library) repository from fons, as it has fallen out of maintenance and does not support the SCRAM-SHA-1 login process. This is my fork: https://github.com/mprelude/cl-mongo -- the main changes are adding a dependence on cl-scram (my implementation of SCRAM), and adding a bson binary generic container. I'm still trying to send the initial message, so the issue isn't that the password is wrong, as that isn't used yet. Why is this part of the

error occurs when installing cryptography for scrapy in virtualenv on OS X [closed]

核能气质少年 提交于 2019-12-23 08:35:59
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I was installing scrapy with pip in virtualenv on OS X 10.11 . When it's installing cryptography, it said: building '_openssl' extension cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict

Implementation of RSA without dynamic allocation

只愿长相守 提交于 2019-12-23 07:47:03
问题 A typical RSA implementation incorporates a multi-precision integer library. A typical multi-precision integer library uses dynamic allocation to represent large integers as arrays of machine words just the right size. I expect there must be a bound on the mathematical integers one may encounter when using the multi-precision integers only to encrypt or decrypt messages of known length (typically, symmetric encryption keys) with, say, RSA-2048, and that it would be possible to implement the

How do I decrypt an AES256 bit cipher in golang that was encrypted in nodejs?

谁说我不能喝 提交于 2019-12-23 06:39:27
问题 I encrypted a string in Node.js like this. var cipher = crypto.createCipheriv( "aes256", "<A Buffer of length 32>", "79b67e539e7fcaefa7abf167de5c06ed" ); I noticed that a buffer in nodejs is like hex but every 2 consecutive characters are paired. So, It's length is half of whatever will come out if I convert it to a hex. Example: Buffer: <Buffer c3 80 36 f6 51 57 cb 6d b0 e8 fd 85 5a a2 8a da 07 4b e7 19 17 d1 c8 ee dc 2a e4 d8 5e 3c 9d a6> Hex:

How do I decrypt an AES256 bit cipher in golang that was encrypted in nodejs?

孤人 提交于 2019-12-23 06:37:05
问题 I encrypted a string in Node.js like this. var cipher = crypto.createCipheriv( "aes256", "<A Buffer of length 32>", "79b67e539e7fcaefa7abf167de5c06ed" ); I noticed that a buffer in nodejs is like hex but every 2 consecutive characters are paired. So, It's length is half of whatever will come out if I convert it to a hex. Example: Buffer: <Buffer c3 80 36 f6 51 57 cb 6d b0 e8 fd 85 5a a2 8a da 07 4b e7 19 17 d1 c8 ee dc 2a e4 d8 5e 3c 9d a6> Hex:

Decrypting AES cipher text using CryptoJS

試著忘記壹切 提交于 2019-12-23 06:06:08
问题 I am trying to follow the instructions seen in the image to complete mutual authentication between a bluetooth smartcard reader and a mobile application. Based on how I've interpreted the instructions, here is my attempt: const randomNumbers = 'd3be845b701b37eff9f24ea6108c0f99'; const masterKey = '41435231323535552d4a312041757468'; const d1 = CryptoJS.AES.decrypt( { ciphertext: CryptoJS.enc.Hex.parse(randomNumbers), }, CryptoJS.enc.Hex.parse(masterKey), { iv: CryptoJS.enc.Hex.parse(

Decrypting AES cipher text using CryptoJS

自闭症网瘾萝莉.ら 提交于 2019-12-23 06:05:27
问题 I am trying to follow the instructions seen in the image to complete mutual authentication between a bluetooth smartcard reader and a mobile application. Based on how I've interpreted the instructions, here is my attempt: const randomNumbers = 'd3be845b701b37eff9f24ea6108c0f99'; const masterKey = '41435231323535552d4a312041757468'; const d1 = CryptoJS.AES.decrypt( { ciphertext: CryptoJS.enc.Hex.parse(randomNumbers), }, CryptoJS.enc.Hex.parse(masterKey), { iv: CryptoJS.enc.Hex.parse(

Python implementation of sha512_crypt.c

ε祈祈猫儿з 提交于 2019-12-23 05:48:09
问题 I'm looking for a 100% pure Python implementation of sha512_crypt.c as taken from http://www.akkadia.org/drepper/SHA-crypt.txt. I'm learning Python. I want to understand the code (and compare it to the C code, etc.). I don't know enough Python to write it myself -- even if I did, I wouldn't trust myself to get it right. I don't have that expertise. So please don't answer this question by telling me to go write the code myself. That's not my question. I am looking for an existing 100% Python