**Cryptography Tutorials - Herong's Tutorial Examples** - Version 5.35, by Dr. Herong Yang

What Is Public Key Encryption?

This section describes public key encryption, also called asymmetric encryption, which uses a pair of keys, a private key and a public key to encrypt and decrypt messages.

**What Is Public Key Encryption?**
Public key encryption is also called asymmetric encryption, which uses a pair of
keys, a private key and a public key. Text encrypted by one key can be decrypted
the other key.

Public key encryption can be used to secure a two-way communication.

For example, Bob wants to communicate with Susan in a secure way. He will generate a private key and a public key. He will encrypt the message with the private key, and send the encrypted message and the public key to Susan. Susan will then decrypt the message with the public key.

If Susan wants to send a response, she will encrypt the response with the public key and send the encrypted response back to Bob. Bob will then decrypt the response with the private key.

This communication process can be illustrated with the following diagram:

Bob Bob Internet Susan Susan

| Encryption | | Decryption | Original | with | Encrypted | with | Original message ->| private key | -> message -> | public key | -> message | Decryption | | Encryption | Original | with | Encrypted | with | Original response <-| private key | <- response <- | public key | <- response

The idea of public key encryption was invented in 1975 by two Stanford mathematicians, Whitfield Diffie and Martin Hellman. Diffie and Hellman failed to give any real algorithm and demonstrated only that public key encryption was possible in theory.

But one year later, in 1976, three MIT mathematicians, Ronald L. Rivest, Adi Shamir, and Leonard M. Adleman invented a real public key algorithm. Their algorithm, called RSA algorithm, is based on factoring theory. See next section for more details.

*Last update: 2013.*

Table of Contents

Introduction to AES (Advanced Encryption Standard)

DES Algorithm - Illustrated with Java Programs

DES Algorithm Java Implementation

DES Algorithm - Java Implementation in JDK JCE

DES Encryption Operation Modes

PHP Implementation of DES - mcrypt

Blowfish - 8-Byte Block Cipher

Secret Key Generation and Management

Cipher - Secret Key Encryption and Decryption

►Introduction of RSA Algorithm

►What Is Public Key Encryption?

RSA Public Key Encryption Algorithm

Illustration of RSA Algorithm: p,q=5,7

Illustration of RSA Algorithm: p,q=7,19

Proof of RSA Public Key Encryption

Efficient RSA Encryption and Decryption Operations

Proof of RSA Encryption Operation Algorithm

RSA Implementation using java.math.BigInteger Class

Introduction of DSA (Digital Signature Algorithm)

Java Default Implementation of DSA

Private key and Public Key Pair Generation

PKCS#8/X.509 Private/Public Encoding Standards

Cipher - Public Key Encryption and Decryption

OpenSSL Introduction and Installation

OpenSSL Generating and Managing RSA Keys

OpenSSL Generating and Signing CSR

OpenSSL Validating Certificate Path

"keytool" and "keystore" from JDK

"OpenSSL" Signing CSR Generated by "keytool"

Migrating Keys from "keystore" to "OpenSSL" Key Files

Certificate X.509 Standard and DER/PEM Formats

Migrating Keys from "OpenSSL" Key Files to "keystore"

Using Certificates in IE (Internet Explorer)