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
8
votes
1 answer

TypeError: argument should be a bytes-like object or ASCII string, not 'dict'

I am getting this error when I am decrypting the encrypted message.I fetched the the encrypted message from the db in django views as pw = donator.objects.filter(emai=email).values('passw')and passed the pw object in the decrypt_message()…
nsb
  • 95
  • 1
  • 4
5
votes
2 answers

How to decrypt a value on a different service that it was originally encrypted with Fernet?

I'm playing around with a project that is python backend-based. I'll have Django for the "core" stuff and FastAPI for some crawlers. I'm encrpting some data to the DB with Django using the Fernet module and a custom Field. class…
Murilo Sitonio
  • 270
  • 7
  • 30
3
votes
1 answer

choosing Fernet encryption algorithm

I'm using Fernet, and confused with cipher algorithms.. how can i try AES, DES, Twofish, RC4 or other algorithms while generating my key. (sorry if messed up:| just new to cipher :) >>> from cryptography.fernet import Fernet >>> key =…
Ali Aref
  • 1,893
  • 12
  • 31
3
votes
1 answer

Fernet encryption/decryption with python and kotlin

I have a project written in python. I use cryptography library to encrypt and decrypt data. I do it how is shown in their tutorial. Here is my python code: import base64 import os from cryptography.fernet import Fernet from…
acmpo6ou
  • 840
  • 1
  • 12
  • 21
2
votes
1 answer

Error while upgrading Airflow 1.11 to 1.15

Hi I'm planning to upgrade my Airflow version from 1.11 to 1.15 which is deployed in OpenShift. As there are very large numbers of DAG's so I planned to upgrade in the bride release rather than going to Airflow 2.2 The error which I'm getting is…
peerpressure
  • 390
  • 4
  • 19
2
votes
4 answers

How to encrypt large file using Python?

I'm trying to encrypt file that is larger than 1GB. I don't want to read it all to memory. I chose Fernet (cryptography.fernet) for this task, because it was most recommended (faster than asymetric solutions). I generated the key. Then I've created…
Mike
  • 113
  • 2
  • 6
2
votes
1 answer

How can I use decrypt_at_time function in Fernet (Python 3.9)

I have a project which encrypts and decrypts texts. I am using Fernet to encrypt and decrypt. I learned how to use encrypt_at_time function but I didn't understood decrypt_at_time function. I was looked…
Yılmaz Alpaslan
  • 327
  • 3
  • 16
2
votes
1 answer

Python Fernet TypeError: token must be bytes

Here i try to insert new row into a table in a database. def insert_record(): values = input('Enter values ').replace(' ', '').split(sep=',') values[-1] = f"{f.encrypt(values[-1].encode())}" c.execute("INSERT INTO credentials VALUES (?,…
Zozo
  • 81
  • 2
  • 8
1
vote
0 answers

cryptography.fernet.InvalidToken error when trying to use a different key to decrypt a cypher with FERNET

So I was basically trying to create a script that would continuously generate keys and hypothetically brute force finding the correct key for the decryption, and running it outputs this: This is the script: from cryptography.fernet import Fernet x…
1
vote
1 answer

What is a fernet key exactly?

According to the documentation for the cryptography.fernet module, fernet keys are: A URL-safe base64-encoded 32-byte key Yet this doesn't work: import secrets from cryptography import fernet f = fernet.Fernet(secrets.token_urlsafe(32)) failing…
Tom
  • 7,269
  • 1
  • 42
  • 69
1
vote
1 answer

Invalid Token when using Fernet library in python

I was trying to use a library I found in python called fernet and make a simple program encrypting and decrypting in python and it worked but when I tried to make it GUI it kept spiting out the error "invalid token". I don't know what I did wrong…
user21776029
1
vote
0 answers

fernet keep giving me Signature did not match digest

I'm working on a password manager app and i want to hash passwords with Fernet, the idea is that I'm writing a password into a file hashed then retrieve it when the user asks here is my code note : the code works properly if there is one password in…
ali nasser
  • 23
  • 2
1
vote
1 answer

How do I decode fernet encryption in R?

I have a string that was encrypted in python using the Fernet algorithm (https://cryptography.io/en/latest/fernet/). How can I read this value in R? Here's the python code which gives some example data import base64 from cryptography.fernet import…
MrFlick
  • 195,160
  • 17
  • 277
  • 295
1
vote
1 answer

cryptography.exceptions.InvalidSignature: Signature did not match digest

I wrote an example of KDC Server, using the package cryptography.fernet. I cannot understand why, randomly, sometimes it runs correctly and sometimes it ends with an exception: cryptography.exceptions.InvalidSignature: Signature did not match…
sam
  • 65
  • 4
1
vote
0 answers

How to directly decoded an encoded value using Cryptography Fernet in Python?

I am new to encryption/decryption algorithms. I have an encrypted value in my config.yaml as below. db_creds: key_id: b'gAAAAABjPbHlcR2CKJaF-CmIuxaIlp_6pvgo24xBTSopD2yKKgTWS2-aTh-IDbrnTHj47u9z1wYHV5tiOHQqOYcVrQsfRYbfkOB--6XRHaGUxjp9274VAgE=' I…
Metadata
  • 2,127
  • 9
  • 56
  • 127
1
2 3
8 9