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.
Questions tagged [python-cryptography]
231 questions
0
votes
0 answers
this decryption code use already-given encrypted private key to decrypt the AES (session) key. an error occurred
code looks something like this:
from Crypto.Cipher import AES
import os
import base64
def decryption(encryptedString):
PADDING ='{'
DecodeAES=lambda c, e:c.decrypt(base64.b64decode(e)).rstrip(PADDING)
a =…
0
votes
2 answers
Working with PEM files using python for SSL connection
I have PEM file containing RSA Private key and list of certificates in it. I am using below code to separate PEM file to Key file and certificate file using pem package and then plugin them into flask server.
This code works, But I want to see if…

user2961127
- 963
- 2
- 17
- 29
0
votes
0 answers
AES encryption and decryption using python 3
I have been trying to write a code which will encrypt and then decrypt the files using AES . IV is a randomly generated and keys are derived on the basis of file name which will be encrypted/decrypted. But the issue is that the code works fine for a…

Mritunjay Kumar
- 1
- 1
0
votes
0 answers
ImportError Cryptography python's module
i'm working on aix6 and trying to ping a windows server via ansible installed on this aix server. But with my python CLI I have an issue with cryptography... :
python
Python 2.7.16 (default, Mar 12 2019, 21:23:24)
[GCC 6.3.0] on aix6
Type "help",…

JCH4
- 1
0
votes
0 answers
Digital Signature verification failing
I'm trying to create a simple DS for a project, where public keys are q (random 224 bit int), p(random 2048 bit int) and a g such that:
pow(g,q,p) == 1. Upon generating signature with function:
def SignGen(message, q, p, g, alpha):
h =…
0
votes
2 answers
Python how to encode with RSA using modulus + exponent
Hello i need to encode text with RSA using modulus and exponent + input
I have tried this, but am getting errors
rsa_modulus = data['publickey_mod']
rsa_exponent = data['publickey_exp']
rsa_timestamp =…

Stringsko
- 23
- 1
- 1
- 7
0
votes
0 answers
Should I generate a new RSA key pair every time a user is going to encrypt a new file?
I'm working on a project in which I'm going to encrypt some files. I already have an AES function implemented, and now I'm implementing an RSA portion. On the AES part, I created a new key every time I was going to encrypt a new file, even if the…

grumpbot
- 23
- 6
0
votes
1 answer
Generating public key with EC in Python
I'm creating JWT parser and now I need to create public key. I made it in Kotlin. But now I have to create same parser in Python. But I got stuck in creating X.509 certificate in python. I tried with cryptography library but with no success. Code in…

Patrik Dendis
- 313
- 6
- 20
0
votes
0 answers
cannot import certificate_transparency
Getting below error in AWS Lambda using when using python 2.7
cannot import certificate_transparency
When I hit the lambda API again the below error starts coming:
cannot import retry
I'm using below…

ReshmaA
- 85
- 1
- 3
- 12
0
votes
1 answer
MD5 Public-Private Key Encryption (python)
I've trying to encrypt my data using asymmetric encryption. I've chosen MD5 as the algorithm. PS: I know about MD5 collisions.
I'm following this blog to encrypt and decrypt my data. This uses SHA256. I'm able to run the code successfully with SHA1,…

Praful Bagai
- 16,684
- 50
- 136
- 267
0
votes
1 answer
How do I access the components of a private RSA key in Python's cryptography module?
I'm not finding an API, but because it seems to delegate to OpenSSL, perhaps I'm not understanding how this works.
What I'm looking for is the equivalent of the first answer to this [1] but from within Python, using an RSA keypair that has just been…

Johannes Ernst
- 3,072
- 3
- 42
- 56
0
votes
1 answer
Chrome NET::err_cert_common_name_invalid error while creating my own certificate using Python's cryptography module
I am creating a certificate signed by own self-signed root authority. This is used to serve a domain hosted as a local app, which is mapped to a localhost address by /etc/hosts file. When the website is requested inside the browser my local app…

QPTR
- 1,620
- 7
- 26
- 47
0
votes
1 answer
Signing Data with OpenSSL and Python3 - signed data cannot be validated
I'm trying to replicate the following steps to sign some data using OpenSSL in a python3 script. When I do the work from the command line, everything works. When I put it into a script, the signed data is not recognized/validated.
How do I get the…

Red Coleman
- 47
- 1
- 7
0
votes
0 answers
Exporting private_bytes of a X25519PrivateKey
Python's cryptography module defines the X25519PrivateKey and X25519PublicKey classes. But while X25519PublicKey has a public_bytes() method for serialization, a corresponding private_bytes method on X25519PrivateKey is missing.
Strangely, a…

Max Tet
- 735
- 1
- 8
- 16
0
votes
0 answers
How do I get access to RSA-encrypted AES key data from EncryptedKey object? Python
I am trying to access key data bytes from an EncryptedKey object. I am unclear on whether this is a PyAsn1 object or a Python object or a Python cryptography object. How do I access the key data? I have tried…

Sheela Singla
- 93
- 1
- 6