DSA Public Key Encryption Tests

This section provides the test result of DSA public key encryption and private key decryption using the javax.crypto.Cipher class.

Here is the result of my first test of JcePublicCipher.java with the DSA algorithm. It is done with JDK 1.6.0.

java JcePublicCipher DSA encrypt dsa.pub JcePublicCipher.java jce.cph

KeyFactory Object Info:
Algorithm = DSA
Provider = SUN version 1.6
toString = java.security.KeyFactory@42e816

Key Object Info:
Algorithm = DSA
Saved File = dsa.pub
Length = 244
Format = X.509
toString = Sun DSA Public Key
    Parameters:DSA
        p:     fca682ce 8e12caba 26efccf7 110e526d b078b05e decbcd1e
               b4a208f3 ae1617ae 01f35b91 a47e6df6 3413c5e1 2ed0899b
               cd132acd 50d99151 bdc43ee7 37592e17
        q:     962eddcc 369cba8e bb260ee6 b6a126d9 346e38c5
        g:     678471b2 7a9cf44e e91a49c5 147db1a9 aaf244f0 5a434d64
               86931d2d 14271b9e 35030b71 fd73da17 9069b32e 2935630e
               1c206235 4d0da20a 6c416e50 be794ca4
        y:     e82a134e b1f8f5ae b40c2709 ccfb9da6 314ef48c ec025a37
               0b7ed86d d35647e2 d3fb17f2 c0ed1bdf dce6ea96 de04a2f6
               8d87666e ed6a1123 588c289a 9ad741ed

Exception: java.security.NoSuchAlgorithmException: Cannot find any 
provider supporting DSA

This tells us that DSA public key and private key are not designed for encryption. They are designed to do digital signing. DSA stands for Digital Signature Algorithm.

Last update: 2013.

Table of Contents

 About This Book

 Cryptography Terminology

 Cryptography Basic Concepts

 Introduction to AES (Advanced Encryption Standard)

 Introduction to DES Algorithm

 DES Algorithm - Illustrated with Java Programs

 DES Algorithm Java Implementation

 DES Algorithm - Java Implementation in JDK JCE

 DES Encryption Operation Modes

 DES in Stream Cipher 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

 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

 javax.crypto.Cipher - The Public Key Encryption Class

 JcePublicCipher.java - Public Key Encryption Sample Program

DSA Public Key Encryption Tests

 RSA Public Key Encryption Tests

 MD5 Mesasge Digest Algorithm

 SHA1 Mesasge Digest Algorithm

 OpenSSL Introduction and Installation

 OpenSSL Generating and Managing RSA Keys

 OpenSSL Managing Certificates

 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)

 Using Certificates in Firefox

 Using Certificates in Google Chrome

 Outdated Tutorials

 References

 PDF Printing Version