Cryptography Tutorials - Herong's Tutorial Examples - v5.42, by Herong Yang
Example of DSA Key Parameters and Properties
This section provides 2 DsaKeyChecker.java output examples to show DSA key parameters and properties.
Let's compile and run DsaKeyChecker.java on my first DSA key pair, dsa_512.pub and dsa_512.pri, generated in the previous tutorial:
herong> javac DsaKeyChecker.java herong> java DsaKeyChecker dsa_512 DSA Key Parameters: p = 13232376895198612407547930718267435757728527029623408872245156039 757713029036368719146452186041204237350521785240337048752071462798273 003935646236777459223 q = 857393771208094202104259627990318636601332086981 g = 54216440574364751416096484883257051280474283943804743768346673007 661082626139005426812890807137245973106730741193551360857959820973906 70890367185141189796 x = 792647853324835944125296675259316105451780620466 y = 10783827985936883407800478884376885258012329124816552994400318669 417122279843086645137200743427232531167766104260606805303022314906254 403593803159583034340 DSA Key Verification: What's key size? 512 Is p a prime? true Is q a prime? true Is p-1 mod q == 0? 0 Is g**q mod p == 1? 1 Is q > x? true Is g**x mod p == y? true
The output looks good. The key size is 512 bits, measured by the number of bits of the prime modulus "p".
Below the output on my second DSA key pair, dsa_1024.pub and dsa_1024.pri:
herong> java DsaKeyChecker dsa_1024 DSA Key Parameters: p = 17801190547854226652823756245015999014523215636912067427327445031 444286578873702077061269525212346307956715678477846644997065077092072 785705000966838814403412974522117181850604723115003930107995935806739 534871706631980226201971496652413506094591370759495651467285569060679 4135837542707371727429551343320695239 q = 864205495604807476120572616017955259175325408501 g = 17406820753240209518581198012352343653860449079456135097849583104 059995348845582314785159740894095072530779709491575949236830057425243 876103708447346718014887611810308304375498519098347260155049469132948 808339549231385000036164648264460849230407872181895999905649609776936 8017749273708962006689187956744210730 x = 774290984479563168206130828532207106685994961942 y = 11413953692062257086993806233172330674938775529337393031977771373 129746946910914240113023221721777732136818444139744393157698465044933 013442758757568273862367115354816009554808091206304096963365266649829 966917085474283297375073085459703201287235180005340124397005934806133 1526243448471205166130497310892424132 DSA Key Verification: What's key size? 1024 Is p a prime? true Is q a prime? true Is p-1 mod q == 0? 0 Is g**q mod p == 1? 1 Is q > x? true Is g**x mod p == y? true
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
RSA Implementation using java.math.BigInteger Class
Introduction of DSA (Digital Signature Algorithm)
►Java Default Implementation of DSA
DsaKeyGenerator.java - Generating DSA Key Pair
DSA 512-bit and 1024-bit Key Pair Examples
DsaKeyChecker.java - Reading and Checking DSA Keys
►Example of DSA Key Parameters and Properties
java.security.Signature - The Data Signing Class
DsaSignatureGenerator.java - Generating DSA Digital Signature
DsaSignatureGenerator.java Test Results
DsaSignatureVerifier.java - Verifying DSA Digital Signature
DsaSignatureVerifier.java Test Results
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"