CryptoBook | Learning Cryptography , math and programming with Cryptol | Math library
kandi X-RAY | CryptoBook Summary
kandi X-RAY | CryptoBook Summary
Learning Cryptography, math and programming with Cryptol (and maybe some Python)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of CryptoBook
CryptoBook Key Features
CryptoBook Examples and Code Snippets
Community Discussions
Trending Discussions on CryptoBook
QUESTION
I am learning the RSA
encryption algorithm, and I want to use that in Python. I'm using the pycryptodome
package, and I can see from there that there are two private keys variables.
What is the difference between pubKey
and pubKeyPEM
, and which of them I need to use for the encryption part?
Also, why the Decryptor
use both of the keys (keyPair
) instead of the private key (privKeyPEM
) ?
ANSWER
Answered 2020-Jul-23 at 10:45pubKey
is just the presentation of the key as usable by Python. It consists of two integers: the modulus and the public exponent. Of course, it could e.g. also be a reference to a key in a hardware device, where applicable.
pubKeyPEM
is a specific encoding of the public key in bytes or characters. It's a SubjectPublicKeyInfo
structure according to the API specifications. SubjectPublicKeyInfo
or SPKI is a binary structure, PEM is an ASCII armor around that, i.e. it specifies the structure and then encodes the binary using base 64. It's commonly used by e.g. OpenSSL.
For the encryption part you need the pubKey
. But you probably have to transport the pubKey
to the sender first, or you may have to store the pubKey
in a DB or filesystem. That's where the export functionality comes in.
The private key generally contains the public key (as public exponent field), or it is easy to calculate it from the private key (in case of an Elliptic Curve key). So you might as well think of the private key as the key pair. It depends on the library if the concepts can be used interchangeably.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install CryptoBook
You can use CryptoBook like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page