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
0
votes
0 answers

ValueError at / Fernet key must be 32 url-safe base64-encoded bytes. keeps giving me issues

I have been getting this error for quite long now. i am trying to decrypt a text content that was encrypted using fernet. the key is passed in through an input element in my django template. after getting the value from the text input, i tried to…
Zubairu
  • 1
  • 1
0
votes
1 answer

Error: Fernet key must be 32 url-safe base64-encoded bytes. Whenever trying to run the program

Here's my code, I'm trying to make a Fernet decoder but whenever I try to run the program I get this error: ValueError: Fernet key must be 32 URL-safe base64-encoded bytes. import dearpygui.dearpygui as dpg from cryptography.fernet import…
KEIKAS
  • 11
  • 2
0
votes
1 answer

PDF file encryption and decryption in python with fernet key

I'm trying to encrypt the pdf file and then trying to decrypt to get its data with fernet key. i'm able to encrypt it successfully but while decrypting it, i'm getting a binary stream not the actual data, please help. (assume all the needed modules…
Abhishek K M
  • 43
  • 1
  • 5
0
votes
0 answers

Unable to decrypt aes-128-cbc in Node when encrypted in Python

I made the following MRE to illustrate my problem. My Python code is taking a string, encrypting it with an ad-hoc created key and posting it to a Node server that is supposed to use the provided key for decryption. Using the console output I can…
Siedler
  • 77
  • 1
  • 12
0
votes
1 answer

Fernet key must be 32 url-safe base64-encoded bytes

import certifi from pymongo import MongoClient import os import platform from cryptography.fernet import Fernet cluster = MongoClient("(database string)", tlsCAFile=certifi.where()) db = cluster["db"] pass_collection = db["password"] def…
0
votes
1 answer

"Fernet" python encoding gives me the following error: ValueError: Fernet key must be 32 url-safe base64-encoded bytes

I have the following code that takes the encrypted keys from a .bin file from cryptography.fernet import Fernet def C(i): f=open('/home/credentials.bin',"rb") e=f.read() e=e.split("\n") e2=e[-2] d = Fernet(e2) …
0
votes
1 answer

cryptography.fernet.InvalidToken When having the correct key

Hello i am trying to decrypte messages i encrypted and stored to a database. i have the encryption key stored locally and i am sure and is constant so its used for encryption and decryption of file. but nevertheless i get invalid token error. what…
0
votes
1 answer

fernet(key).decrypt(value) cleaning all the contents

I'm generating a key in the encryption file and using Fernet(key).encrypt(contents) to encrypt the contents. Later I am using the same key and using Fernet(key).decrypt(contents) to decrypt the content but it's removing all the contents and the…
0
votes
1 answer

How to decrypt a string with fernet as a flask service?

I am making a simple flask api which is encoding and decoding the coming string. I have no problem with encoding but I am getting InvalidToken error when decoding. I tried smth. but could not make it. Code: from flask import…
aoiTenshi
  • 547
  • 1
  • 6
  • 20
0
votes
1 answer

Airflow fernet key does not mask credentials

I am using Apache Airflow 2.2.3 with Python 3.9 and run everything in docker containers. When I add connections to airflow I do it via the GUI because this way the passwords were supposed to be encrypted. In order for the encryption to work I…
omer9742
  • 27
  • 5
0
votes
0 answers

fernet: cryptography.fernet.InvalidToken when decrypting a file

I'm trying to decrypt a string using fernet. My code (assume files already exist with pre-filled data): import hashlib import bcrypt from cryptography.fernet import Fernet import…
Thomas
  • 1,214
  • 4
  • 18
  • 45
0
votes
1 answer

Encrypting message with user input as key - python Fernet

I am trying to use Fernet to encrypt some text using user input as a key. However, I get an error. I've looked online but I can't find anything that helps. My code (all for testing purposes): message = 'test message' message =…
john
  • 11
  • 4
0
votes
1 answer

cryptography.fernet.InvalidToken

So, I have a program that is supposed to connect two machines through TCP sockets. I'm trying to implement encryption with RSA keys, using the 'cryptography' library. But, once I run the code, I get the cryptography.fernet.InvalidTokenerror. here is…
0
votes
1 answer

How to decrypt config.ini file keeping its original (before encyrpt) format and extension (Python - cryptography fernet)

Here is my code to encrypt the config.ini file which has sql connection details (username and pw) and some file paths. from cryptography.fernet import Fernet key = Fernet.generate_key() i_file = 'conf.ini' o_file = 'Conf_encry.ini' with…
Finch
  • 71
  • 1
  • 9
0
votes
1 answer

Error: Fernet key must be 32 url-safe base64-encoded bytes

I'm currently working on an ecrypting/decrypting program in Python using Fernet. Here's my code so far: from cryptography.fernet import Fernet def decrypter(): enc_message = input("Input an encrypted string:\n") key = input("Input a key:\n") …
1 2 3
8 9