Questions tagged [fernet]

Fernet is a protocol for symmetric encryption providing integrity / authentication, a set of encryption libraries that comply with the protocol and possibly an underlying "hazmat" library that contains a set of cryptographic algorithms.

You can find the Fernet specification here.

Libraries are available for the following programming languages:

Unofficially the following libraries claim conformance:

126 questions
1
vote
1 answer

Failing to print value

I'm new to python, an I decided to write a simple password manager to learn. I'm having trouble retrieving one of the values out of the dictionary. The function add_password write a key with 2 values (user, and password (encrypted)) And the function…
Ae3erdion
  • 51
  • 7
1
vote
1 answer

Fernet encrypt results varies with same key

Fernet encryption token varies even though the key remains the same. Executing the following example repeatedly will show that. from cryptography.fernet import Fernet f =…
cheesus
  • 1,111
  • 1
  • 16
  • 44
1
vote
1 answer

How would I encrypt a list of files in Python using fernet?

I am trying to create a python script in which you run through all the files in the directory and encrypt them as an alternative to BitLocker. One of the files is just an example passkey as a proof of concept. I got so far as to get the passkey(s)…
Pork Lord
  • 164
  • 8
1
vote
0 answers

Runtime using fernet library

I was recently learning about encryption in python and tried out fernet library. Encryption and decryption was successful but I have some questions about the Runtime. While encrypting py,txt files which are usually of low storage size(bytes),…
1
vote
0 answers

Problem with cryptography.fernet: Raise an error but still decrypts

I created two .py, one for encryption and one for decryption. Here they are. Encryptor.py import os from cryptography.fernet import Fernet files = [] for file in os.listdir(): if file == "encryptor.py" or file == "decryptor.py" or file…
1
vote
2 answers

Error while trying to decrypt using Fernet

After creating a simple python encryption code with fernet library (that worked great) I tried to code a decryptor but unfortunately while trying to use my decryptor i got the following error ['blahblahblah.txt', 'blah.txt'] Traceback (most recent…
Lorenzo
  • 11
  • 2
1
vote
1 answer

Django Encrypt FileField with Fernet object has no attribute '_committed' occurred

I am passing multiple pdf uploads into the view from a form. (using Uppy.XHRUpload) I want to encrypt them before saving them in the model. When i test the files they can be encrypted and saved to a file and then read and decrptyped just fine. But…
diogenes
  • 1,865
  • 3
  • 24
  • 51
1
vote
0 answers

Decrypt an encrypted text using Fernet in Dart Flutter

i am trying to decrypt an encrypted text in dart. I am getting the error Unhandled Exception: Invalid argument(s): Input data length must be a multiple of cipher's block size . I am not too sure what the error means. Google wasn't really helpful.…
winfred adrah
  • 428
  • 6
  • 18
1
vote
0 answers

python fernet - decrypt exception InvalidToken - user login authentication

I am trying to implement the solution (encryption of data with password) provided in the fernet docs under Using passwords with Fernet. Since I would also like to use the same password for user login authentication I would like to know if it is safe…
simbr
  • 75
  • 1
  • 9
1
vote
1 answer

Encryption with NodeJS doesn't match encryption using Python (cryptography.fernet)

Cryptography noob here. I'm trying to write a script in NodeJS that encrypts a string and produces output that matches the output of my Python script that uses the cryptography.fernet library. My overall goal is to use the original key to encrypt…
EhMaMuffin
  • 47
  • 1
  • 6
1
vote
2 answers

Why can't i decrypt the database values with fernet [Python]?

im trying to retrieve encrypted values in the database, and decrypt them. But it's not working for me. This are the records from sqlite3 which im trying to…
Poop poop
  • 63
  • 8
1
vote
1 answer

How to convert string to use with Fernet in Python

I want to convert a string to use it as a custom key for Fernet. Current code masterKey = base64.b64encode("F4D27D47".encode("utf-8")) crypter = Fernet(masterKey) However this raises and exception: ValueError: Fernet key must be 32 url-safe…
1
vote
1 answer

Fernet in python, "token must be bytes"

Okay so this is my code: @client.command(aliases=['d'], pass_context=True) async def decrypt(ctx, arg, member=discord.Member): key = b'xxxxxx' f = Fernet(key) decrypted = f.decrypt(arg) channel = await member.create_dm() await…
1
vote
1 answer

Creating custom Django encrypted field with Fernet

I'm trying to create a django custom encryption field using Fernet. The libraries I found for doing it automatically seems to be outdated/non compatible with Django>3.0 In this thread I found the following code: import base64 from django.db.models…
1
vote
3 answers

Decrypt with Fernet, TypeError: token must be bytes

Programming language: Python i have three files, one is to generate the key, 2nd is to encrypt, and the other is to decrypt.. the 1st and the 2nd files work.. but the decrypt file won't work generate key file: from cryptography.fernet import…
Hirusha Adikari
  • 150
  • 1
  • 14
1
2
3
8 9