Questions tagged [python-cryptography]

python-cryptography is a python library for secure cryptographic services. The module includes both high level recipes and low level interfaces to common cryptographic algorithms such as symmetric ciphers, message digests, and key derivation functions.

231 questions
0
votes
1 answer

create cypher file from pdf file using python(i would like to use blowfish algorithm)

I want to encrypt a whole data of a pdf file using blowfish algorithm. I feel password protection is not enough. The pdf can contain images text tables etc. The pdf will be a thesis of PHD student.
0
votes
1 answer

How to convert C# password hashing with salt to python for windows

How to convert below code in Python so that it gives same value on Windows even when executed multiple times. Basically, it hashing password using sha512 and salt with 1000 iterations. Here is the code: using System; using…
rahoolm
  • 733
  • 2
  • 12
  • 22
0
votes
0 answers

cryptography.fernet.InvalidToken error when decrypting existing salt

Preamble: I did search StackOverflow and I know someone had a question like mine, but now (a couple months after first seeing it), I could not find that answer again. I'm fully aware there is likely a duplicate, but for the life of me, I cannot find…
Chris
  • 126
  • 1
  • 2
  • 9
0
votes
1 answer

Error Decrypting file stored in a MySQL DB using Flask and Cryptography

I'm using Flask and the Cryptography package to receive a .csv file from the user, encrypt it, store it in the MySQL Database and then, retrieving and decrypting it. Once I get the file uploaded from the user I do the following to encrypt it: from…
Matheus Torquato
  • 1,293
  • 18
  • 25
0
votes
1 answer

Read a binary file stored in HDFS with Python

I have some binary files. When i store them to local files i can read them as binary files. with open("binary_file", 'rb') as f: print("Binary file: ", f.read()) Result: Binary file: b'Ix\x9d\xdf\xd2\xf6\x83\xe8B\x95.... (a long binary) But…
Ermolai
  • 303
  • 4
  • 15
0
votes
1 answer

pycryptodome equivalent C# RSA.SignHash?

Hello i'm trying to port some RSA encryption code from a C# application to python using python https://pycryptodome.readthedocs.io/ But my problem is i'm stuck on this line using System.Security.Cryptography; ... result = RSA.SignHash(testData,…
0
votes
0 answers

SSH vulnerability detected in file cryptography/hazmat/primitives/serialization/ssh.py

I have written a python application that uses cryptography as one its dependencies. This application is used by another team. Since they intend to run this application on their AWS server, They'll have to package the application along with the its…
0
votes
2 answers

How to convert bytes to string for encrypting?

I am encrypting a text file using cryptography.fernet and then using the write function to write it in my file but I am getting the error write() argument must be a str not a byte. Here's the code: from cryptography.fernet import Fernet message =…
Nycelease
  • 23
  • 1
  • 6
0
votes
0 answers

Searching for matches between sublists

For my final year cryptography module, we learned Shank's "Baby-Step, Giant-Step" algorithm for solving the discrete logarithm problem in modular arithmetic. Now, in Python, I have coded an algorithm (my exam has been and gone so this isn't to…
0
votes
1 answer

AttributeError: 'bytes' object has no attribute 'encrypt_at_time' in MultiFernet

Just Trying to Encrypt the plain text using MultiFernet. My code is: from cryptography.fernet import Fernet, MultiFernet fetnet_keys = [ Fernet.generate_key(), Fernet.generate_key() ] mulfern = MultiFernet(fetnet_keys) enc =…
Chandan Sharma
  • 2,321
  • 22
  • 22
0
votes
0 answers

ModuleNotFoundError: No module named 'cryptography' - Unable to recognize cryptography

I've installed and reinstalled Python 3 (using version 3.7.9) as well as pip and cryptography via the command prompt with success (message below): Requirement already satisfied: cryptography in…
0
votes
1 answer

How do I sign an AMP update-cache request with Python's cryptography package?

How do I sign a URL for AMP's update-cache API using Python's cryptography package?
ldrg
  • 4,150
  • 4
  • 43
  • 52
0
votes
0 answers

Cryptography.py using encrypt with private key and decrypt with public key

I need to encrypt a string using a private key. Then I want to use the asymmetric public key to decrypt the encrypted string and obtain the original string. I am using cryptography.py which allows the opposite (public for encryption and private for…
Kyle C
  • 43
  • 4
0
votes
1 answer

How to choose your own password in cryptography library in python?

I have this sample code that generates the key (password) by the fernet function to encrypt the string but what I want to do is choosing the password myself. How can I do it, please? from cryptography.fernet import Fernet key =…
0
votes
1 answer

Why Installation of Cryptography python package is failing?

I am trying to install a package Cryptography in Python but each time I try it's failing with error.Command I used to install this package is: pip install cryptography==2.8 Error I'm getting is as follows: Collecting cryptography==2.8 Using cached…
shary.sharath
  • 649
  • 2
  • 14
  • 29