Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Is AES-256 supported? #3446
Hi, I'm working on a project that shares encrypted values with an existing Node system using AES 256 via crypto-js. What I would like to do is encrypt / decrypt the values in Python with cryptography as well.
I'm trying to understand if AES 256 is currently supported?
I wasn't able to answer this clearly myself from the docs. For example, I see references to 256-bit key sizes in some tests and mentions of 256-bit keys in the AES algorithm class docs but the Fernet class (which seems to be the encouraged app user level interface) looks to use 128 bits for the AES key per the docs and linked spec. On the other hand, this library seems to be referenced as the modern replacement for others such as PyCrypto.
AES 256 seems like a common use case, so finding myself poking around the hazmat layer concerned me that I may be missing a higher level interface like the Fernet class but using AES 256.
Yes, cryptography supports AES256, as this example demonstrates: https://cryptography.io/en/latest/hazmat/primitives/symmetric-encryption/?highlight=aes#cryptography.hazmat.primitives.ciphers.Cipher
Fernet is a specific recipe that implements a pre-defined protocol, it happens to use AES128.