pycrypto

Install paramiko on Windows

谁都会走 提交于 2020-01-09 17:59:36
问题 OK. I read installing paramiko on Windows. All mentioned methods simply do not work. Authors have different environments with different components/libraries installed. Or may be they don't test their solutions before posting an answer :) I removed all python versions and libs from my machine (Windows 8 x64) and tried to install python and paramiko from scratch. Method number 1 (FAILED) Install python-2.7.3.amd64.msi Install pycrypto-2.6.win-amd64-py2.7.exe Download https://github.com/paramiko

Parse RSA key pair from string in Python

我是研究僧i 提交于 2020-01-06 04:24:44
问题 I'm trying to generate/read a RSA-keypair from the publicKey and the privateKey as a String. Something like this: priK = "-----BEGIN RSA PRIVATE KEY-----MIIBOQIBAAJAVJhUS0gLqXLOmVv2xG23oFPwim9+rVxGhLUXqKShQCvB3iRMOHn7/GNJumpwmnglcsNXuqAhN0OxqKGGJdtYdwIDAQABAkBP0VrXnSbDvvuIX+k59Xvo3sp7FDAmSoaO+H9WM9+ht5H/f/geIrSEXSIkFLnzniMwtOJ422GmkDkL1F67HuDhAiEAlNauDiq3RqoXufbauyPEOG9fMS2pvB+auT2XCHJhhKsCIQCRgIo7WIRZYnNpNRWaoppUQK3g+aM8sdeBYpbs2nwDZQIgZXIxrmxFAUAb7d+oVFdbfc

Get the counter value after decrypt finished

风格不统一 提交于 2020-01-03 05:13:13
问题 I am trying to decrypt AES-CTR in SSH using the keys generated by the openssh/openssh-portable library. I extracted the keys successfully from memory. Now, after some printfs and research I found out that it seems like the initial counter is incremented for every encrypted packet, which means that a successor packet(not byte) has a different Counter value as the pre-packet. For my decryption I want to decrypt packet by packet, so now my question is: Can I somehow get the "end" counter of the

How can I decrypt something with PyCrypto that was encrypted using OpenSSL?

心已入冬 提交于 2020-01-03 03:16:11
问题 I have several strings that were encrypted using OpenSSL. For instance: $ echo "original string" | openssl aes-256-cbc -p -a -pass pass:secret salt=B898FE40EC8155FD key=4899E518743EB0584B0811AE559ED8AD9F0B5FA31B0B998FEB8453B8E3A7B36C iv =EFA6105F30F6C462B3D135725A6E1618 U2FsdGVkX1+4mP5A7IFV/VcgRs4ci/yupMErHjf5bkT5XrcowXK7z3VyyV1l2jvy I would like to decrypt these things using Python. I'm attempting to use PyCrypto. Here's an exmaple script using the above data: from base64 import b64decode,

Encrypting data in Python -

一笑奈何 提交于 2020-01-01 19:48:06
问题 I'm writing a client - server model ( client is a script on a server that gathers data and sends it via REST to the server ) and want to encrypt the data that is sent. At the moment I have a function that generates the a random key, which adds time from a specific timezone - IP-HOSTNAME-YEAR-MONTH-DAY-HOUR-(MINUTE/2) Each part of the key is ran from 3,000 - 10,000 times trough a SHA256 and finally the 128 bit key is generated. Script all in all takes ~0.8 - 1 second to complete. Data is

PyInstaller not correctly importing pycrypto… sometimes

末鹿安然 提交于 2020-01-01 18:25:12
问题 I'm packaging a project with PyInstaller on different ubuntu machines. On some of them, when executing the generated project, it throws this error: File "~/PyInstaller-2.1/proj/build/proj/out00-PYZ.pyz/Crypto.Random", line 28, in ImportError: cannot import name OSRNG However the import works perfectly ok in python console and I can execute the project without packaging it. I've tried uninstalling and reinstalling pycrypto without success, I've also tried adding a specific from Crypto.Random

Need advice about AES CTR cipher python vs. Java

痴心易碎 提交于 2020-01-01 07:12:46
问题 I'm working on project when some arbitrary data are encrypted using Python simple-crypt (source here) and same encrypted data are then used in java application. I would like to understand conceptual difference between JSSE and Pycrypto. This is python part doing encryption (source): counter = Counter.new(HALF_BLOCK, prefix=salt[:HALF_BLOCK//8]) cipher = AES.new(cipher_key, AES.MODE_CTR, counter=counter) This is my attempt for java re-implementation of same operation: SecretKeySpec key = new

Is AES the same in libraries PyCrypto & Node.JS Crypto

回眸只為那壹抹淺笑 提交于 2020-01-01 06:29:18
问题 I am beginnging to wonder if the implementation of AES is different across libraries.. Currently i have a plaintext encrypted with PyCrypto. Im trying to decrypt the ciphertext with Node.js's Crypto Library.. Basically with PyCrypto.. im using AES-128-CBC with a random generated IV. (which decrypts perfectly in PyCrypto) However.. On Node.js im doing this var buf = new Buffer(ciphertext) var decipher = crypto.createDecipher('aes-128-cbc',aeskey) buf = decipher.update(buf,'binary', 'binary')

Building PyCrypto with fastmath (gmp or mpir) via pip on Windows

谁说我不能喝 提交于 2020-01-01 05:29:04
问题 I installed PyCrypto on Windows via pip but i was not able to build Crypto.PublicKey._fastmath because GMP was not found. I know there is a binary version on voidspace but i would like to build the latest version of PyCrypto 回答1: The following one is a way to achieve your goal. There are other, probably better ways (e.g. based on Visual Studio), but this one has worked for me. Additionally, it does not use pip . All operations are carried out on a command prompt. Install Mingw, including MSYS

pycrypto - Ciphertext with incorrect length

戏子无情 提交于 2020-01-01 04:32:05
问题 I've generated a public and private key with pycrypto, and I save them to a file using export key: from Crypto.PublicKey import RSA bits=2048 new_key = RSA.generate(bits, e=65537) prv = open('keymac.pem','w') prv.write(new_key.exportKey('PEM')) prv.close() pub = open('pubmac.pem', 'w') pub.write(new_key.publickey().exportKey('PEM')) pub.close() I use the public key to encrypt a file (following http://insiderattack.blogspot.com/2014/07/encrypted-file-transfer-utility-in.html#comment-form) When