CryptoBook | MDBook built by the CryptoHack community
kandi X-RAY | CryptoBook Summary
kandi X-RAY | CryptoBook Summary
I am starting this repository to motivate myself to create a space to document the mathematics I am learning while building CryptoHack and learning cryptography. More than anything, I am grateful for the community of people within CryptoHack who have made the discord such an interesting and educational place, and I hope that this repo can become an extension of that, helping each other learn in a more formal and permanent setting. My first goal for this book is to include background chapters on some aspects of pure mathematics which appear in cryptography. Something I feel that is commonly missing from texts is why certain protocols use certain properties. Why do perform Diffie-Hellman key exchange in Abelian groups? Of all the curves, why do we pick elliptic curves? Would conic sections be ok? To have a proper appreciation for this, I think a offering a discussion on the fundementals of the inner workings of cryptographic protocols is necessary. My hope is to present this in a form which is palatable for people without formal educations in mathematics. Another goal of this project is to include code snippets as examples of protocols, attacks and maths tricks as standard. I know several of us have used the sage docs when trying to solve CTFs and commonly it's hard to find precisely what functions to use, and when. I would like this book to have chapters devoted to protocols and their weaknesses. Implmentation of attacks with code given. For now, I think it would be best to have examples given in sage/python and as the book grows, we can look to Magma, or lower-level programming languages. I hope these two goals are interesting to the community and that together we can create a great resource together. The book is run using mdbook. The whole book is built from markdown files and should be simple to upkeep. We have access to MathJax for latex maths, and we have code highlighting for code snippets.
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
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