Cryptography and Cryptanalysis in Java: Creating and Programming Advanced Algorithms with Java SE 17 LTS and Jakarta EE 10 1st Edition Stefania Loredana Nita download
Cryptography and Cryptanalysis in Java: Creating and Programming Advanced Algorithms with Java SE 17 LTS and Jakarta EE 10 1st Edition Stefania Loredana Nita download
https://ebookmeta.com/product/cryptography-and-cryptanalysis-in-
java-creating-and-programming-advanced-algorithms-with-java-
se-17-lts-and-jakarta-ee-10-1st-edition-stefania-loredana-nita/
https://ebookmeta.com/product/cryptography-and-cryptanalysis-in-
matlab-creating-and-programming-advanced-algorithms-1st-edition-
marius-iulian-mihailescu/
https://ebookmeta.com/product/pro-cryptography-and-cryptanalysis-
with-c-20-creating-and-programming-advanced-algorithms-1st-
edition-marius-iulian-mihailescu/
https://ebookmeta.com/product/fire-resistant-design-of-
structures-1st-edition-srinivasan-chandrasekaran/
Manufacturing Technologies and Production Systems
Principles and Practices 1st Edition Abhineet Saini
https://ebookmeta.com/product/manufacturing-technologies-and-
production-systems-principles-and-practices-1st-edition-abhineet-
saini/
https://ebookmeta.com/product/the-first-world-empire-portugal-
war-and-military-revolution-1st-edition-holder-carvalhal/
https://ebookmeta.com/product/for-the-love-of-justice-the-
nightwatch-academy-4-5-1st-edition-debbie-cassidy/
https://ebookmeta.com/product/mining-and-sustainable-development-
current-issues-1st-edition-sumit-k-lodhia-editor/
https://ebookmeta.com/product/forbidden-lies-the-forbidden-
truths-duet-1-1st-edition-amber-nicole/
Arts and Humanities 1st Edition Brueggemann Brenda Jo
https://ebookmeta.com/product/arts-and-humanities-1st-edition-
brueggemann-brenda-jo/
Cryptography and
Cryptanalysis in Java
Creating and Programming Advanced
Algorithms with Java SE 17 LTS
and Jakarta EE 10
Chapter 1: Introduction�������������������������������������������������������������������������������������������� 1
Cryptography and Cryptanalysis��������������������������������������������������������������������������������������������������� 3
Book Structure������������������������������������������������������������������������������������������������������������������������������ 4
Conclusion������������������������������������������������������������������������������������������������������������������������������������ 6
References������������������������������������������������������������������������������������������������������������������������������������ 6
Chapter 3: R
oadmap and Vision for Jakarta EE 10������������������������������������������������� 21
Conclusion���������������������������������������������������������������������������������������������������������������������������������� 27
References���������������������������������������������������������������������������������������������������������������������������������� 28
v
Table of Contents
Chapter 5: C
lassical Cryptography������������������������������������������������������������������������� 47
Caesar Cipher������������������������������������������������������������������������������������������������������������������������������ 48
Implementation��������������������������������������������������������������������������������������������������������������������� 49
Cryptanalysis������������������������������������������������������������������������������������������������������������������������� 53
Vigenère Cipher��������������������������������������������������������������������������������������������������������������������������� 53
Implementation��������������������������������������������������������������������������������������������������������������������� 56
Cryptanalysis������������������������������������������������������������������������������������������������������������������������� 59
Hill Cipher����������������������������������������������������������������������������������������������������������������������������������� 60
Implementation��������������������������������������������������������������������������������������������������������������������� 61
Cryptanalysis������������������������������������������������������������������������������������������������������������������������� 67
Conclusion���������������������������������������������������������������������������������������������������������������������������������� 68
References���������������������������������������������������������������������������������������������������������������������������������� 68
Chapter 7: P
seudorandom Number Generators������������������������������������������������������ 87
Examples of PRNGs��������������������������������������������������������������������������������������������������������������������� 89
Linear Congruential PRNGs��������������������������������������������������������������������������������������������������� 89
Blum-Blum-Shub PRNG��������������������������������������������������������������������������������������������������������� 89
Linear Circuit PRNGs������������������������������������������������������������������������������������������������������������� 90
Other PRNGs�������������������������������������������������������������������������������������������������������������������������� 91
PRNGs Security���������������������������������������������������������������������������������������������������������������������� 91
Java.util.Random Class��������������������������������������������������������������������������������������������������������� 92
vi
Table of Contents
Conclusion���������������������������������������������������������������������������������������������������������������������������������� 97
References���������������������������������������������������������������������������������������������������������������������������������� 97
Chapter 8: H
ash Functions������������������������������������������������������������������������������������ 101
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 109
References�������������������������������������������������������������������������������������������������������������������������������� 110
Chapter 9: S
ymmetric Encryption Algorithms������������������������������������������������������ 113
Data Encryption Standard��������������������������������������������������������������������������������������������������������� 113
The Generation of Keys������������������������������������������������������������������������������������������������������� 115
Encryption and Decryption Process������������������������������������������������������������������������������������ 116
Operation Modes for DES���������������������������������������������������������������������������������������������������� 117
Advanced Encryption Standard������������������������������������������������������������������������������������������������� 123
Encryption and Decryption Process������������������������������������������������������������������������������������ 123
Operation Modes for AES����������������������������������������������������������������������������������������������������� 124
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 129
References�������������������������������������������������������������������������������������������������������������������������������� 130
Chapter 10: A
symmetric Encryption Schemes����������������������������������������������������� 131
RSA������������������������������������������������������������������������������������������������������������������������������������������� 133
ElGamal������������������������������������������������������������������������������������������������������������������������������������� 138
Merkle-Hellman������������������������������������������������������������������������������������������������������������������������ 143
The Knapsack Approach������������������������������������������������������������������������������������������������������ 143
Algorithms��������������������������������������������������������������������������������������������������������������������������� 144
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 145
References�������������������������������������������������������������������������������������������������������������������������������� 145
Chapter 11: S
ignature Schemes��������������������������������������������������������������������������� 147
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 156
References�������������������������������������������������������������������������������������������������������������������������������� 156
vii
Table of Contents
Chapter 14: A
dvanced Encryption Schemes��������������������������������������������������������� 195
Homomorphic Encryption��������������������������������������������������������������������������������������������������������� 195
Searchable Encryption�������������������������������������������������������������������������������������������������������������� 199
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 201
References�������������������������������������������������������������������������������������������������������������������������������� 201
Chapter 15: C
ryptography Tools��������������������������������������������������������������������������� 205
CryptTool����������������������������������������������������������������������������������������������������������������������������������� 205
OpenSSL����������������������������������������������������������������������������������������������������������������������������������� 215
Conclusion�������������������������������������������������������������������������������������������������������������������������������� 221
References�������������������������������������������������������������������������������������������������������������������������������� 222
Index��������������������������������������������������������������������������������������������������������������������� 223
viii
About the Authors
Stefania Loredana Nita, PhD, is a lecturer at “Ferdinand I” Military Technical Academy
of Bucharest and a software developer and researcher at the Institute for Computers. Her
PhD thesis was on advanced cryptographic schemes using searchable encryption and
homomorphic encryption. At the Military Technical Academy, she teaches the Formal
Languages and Translators and Database Application Development courses. She worked
for more than two years as an assistant lecturer at the University of Bucharest where
she taught courses on subjects such as advanced programming techniques, simulation
methods, and operating systems. Her research activity is in the cryptography field, with
a focus on searchable encryption and homomorphic encryption. She is also interested
in blockchain, quantum cryptography, machine learning, and artificial intelligence.
At the Institute for Computers, she is working on research and development projects
that involve cloud computing security, the Internet of Things, and big data. She has
authored or co-authored more than 28 papers at conferences and for journals and has
co-authored five books. Also, she holds an MSc in software engineering and two BSc
degrees in computer science and mathematics.
Marius Iulian Mihailescu, PhD, has worked in the academic and industry sector
for more than 15 years. Currently, he is an associate professor (senior lecturer) of
engineering and computer science at “Spiru Haret” University, Romania, and as a side
job he is a project manager at the Institute for Computers where he is managing different
projects using different technologies, such as DevOps, Scrum, Agile, C#, Microsoft
SQL Server, Syncfusion, ASP.NET, and VUE. At the university, he has taught several
key computer science courses about information security, functional programming,
Interne of Things, blockchain, software development methods (Microsoft Azure,
Entity Framework, NHibernate, LINQ-to-SQL, UX with DevExpress controls, etc.), and
development web applications (HTML 5, CSS 3, Bootstrap, JavaScript, AJAX, NodeJS,
VUE, Laravel, mRabbit, ASP.NET, PHP). He has authored or co-authored more than
ix
About the Authors
30 articles in conference proceedings, 25 articles in journals, and six books. For three
years he worked as an IT officer at Royal Caribbean Cruises Ltd. where he dealt with IT
infrastructures, data security, and satellite communications systems. He received his
PhD in 2014, and his thesis was on applied cryptography over biometrics data. He holds
two MSc degrees in information security and software engineering, from “Ferdinand I”
Military Technical Academy and the University of Bucharest, Romania.
x
About the Technical Reviewer
Doug Holland is a software engineer and architect at Microsoft Corporation. He
holds a master’s degree in software engineering from the University of Oxford. Before
joining Microsoft, he was honored with the Microsoft MVP and Intel Black Belt
Developer awards.
xi
CHAPTER 1
Introduction
In the last decade, technology has rapidly evolved. Statistics show that 64.2 zettabytes of
data were generated in 2020 (1 zettabyte is equivalent to 1021 bytes or 1012 gigabytes), and
it is predicted that by 2025, the digital data generated will reach 181 zettabytes [1, 2].
Electronic communication has become an essential part of our lives, and due to its
rapid evolution, all manner of security issues have arisen. Because digital messages,
in all of their forms, are sent daily over public networks across the world, the need
for secure channels and security mechanisms has also increased. Digital devices and
communications should have digital signatures that make them easy to authenticate.
Modern cryptography provides solutions for all these requirements.
The era in which we are living is considered the “zettabytes era,” in which technology
allows humans and electronic devices to generate and send information instantly, at
any time and any place. Advanced technologies, such as the Internet of Things, fog
computing, edge computing, smart vehicles, drones, smart houses, and many other
complex software (desktop/web/mobile) solutions or architectures, are evolving so
quickly that it is difficult to keep up with security requirements. For example, at the time
of this book’s writing, there are 160,974 records of vulnerabilities registered on the CVE
platform [3]. However, lessons can be learned even from failures, so by analyzing such
vulnerabilities, security solutions can be improved.
One of the most important aspects considered when complex systems are
designed and implemented is knowledge. In antiquity, the Latins said Scientia
potentia est, meaning “Knowledge is power” [4]. In the 21s century, this is even more
true; information falling into the wrong hands can lead to huge business losses and
catastrophic outcomes. Cryptography and information security provide security
1
© Stefania Loredana Nita and Marius Iulian Mihailescu 2022
S. L. Nita and M. I. Mihailescu, Cryptography and Cryptanalysis in Java,
https://doi.org/10.1007/978-1-4842-8105-5_1
Chapter 1 Introduction
mechanisms that can protect information shared between senders and recipients over
insecure channels, so that unauthorized users cannot access or alter the transmitted
information. Over time, there were encryption systems that were broken by attackers by
exploiting vulnerabilities of the systems.
The word cryptography comes from the Greek words kryptos and graphein, meaning
“hidden” and “writing,” respectively. As its name suggests, the purpose of cryptography
is to hide messages from unauthorized individuals and to keep their integrity. Although
the study of cryptography has been around only about 100 years, it was used in different
forms from ancient times. However, over time there have been various primary methods
of hiding secret messages, starting with hieroglyphs, continuing with Caesar's famous
cipher, followed by the Vigenère cipher, Hebern’s rotor machine, and the famous
Enigma machine. Nevertheless, hiding messages was not the only occupation close
to cryptography or, rather, information security. Another example is authentication or
identity verification; this was often done through seals.
Cryptography is considered an art, especially in its primary phases. The history of
cryptography began in ancient Egypt, alongside the art of writing, during a time when
humans started organizing in different social groups. This organization led to a natural
need of transmitting information only to certain individuals, with the same group, tribe,
etc. Early forms of cryptography were hieroglyphs, which started to be used about 4,000
ago by Egyptians—only they recognized the symbols and their meaning. An inscription
carved circa 1900 BC contains the first known evidence of cryptography (in some kind).
It is located in Egypt nobleman Khnumhotep II’s tomb, in the main chamber [5]. In this
inscription, some symbols have a different form than usual, and the scribe’s intent was
not necessary to hide a message; rather, he wanted the symbols to look nobler than usual
according to the social status of the deceased. Although the inscription does not hide
a message, it contains an altered/transformed form of the original symbols, being the
oldest proof of such an approach. Then, cryptography in the ancient world moved to a
substitution approach, in which every symbol of an alphabet was replaced by another
symbol based on a secret rule. This was happening around 500–600 BC. The next notable
cipher was Caesar’s cipher. Caesar was a Roman emperor who was communicating
with his army generals with encoded messages, using a substitution within the Roman
alphabet. Each letter was shifted a certain number of positions in the alphabet, usually
three. For example, the correspondent of A was D, of B was E, and so on. This is an
important historical cipher that is mentioned often in cryptography literature. The next
important achievement in cryptography was in the Middle Ages by Leon Battista Alberti,
who implemented polyalphabetic substitution. Two rotating copper disks were used that
2
Chapter 1 Introduction
3
Chapter 1 Introduction
Book Structure
This book contains 15 chapters, in which the main aspects of classical and modern
cryptography are presented. Generally, the chapters will cover the foundation of the
presented concept/mechanism/technique from a mathematical perspective and then a
practical implementation or use cases in Java. The following chapters are detailed here:
• Chapter 2, “JDK 17: New Features”: This chapter will cover the new
features of Java 17 and will show some practical examples.
4
Discovering Diverse Content Through
Random Scribd Documents
The Project Gutenberg eBook of The Greek
Romances of Heliodorus, Longus and Achilles
Tatius
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Language: English
AND
1901.
CONTENTS.
PREFACE
Summaries:
HELIODORUS.
LONGUS.
ACHILLES TATIUS.
THE ADVENTURES OF THEAGENES AND CHARICLEA.
BOOK II.
BOOK III.
BOOK IV.
BOOK V.
BOOK VI.
BOOK VII.
BOOK VIII.
BOOK IX.
BOOK X.
THE LOVES OF DAPHNIS AND CHLOE, A PASTORAL NOVEL.
BOOK II.
BOOK III.
BOOK IV.
THE LOVES OF CLITOPHO AND LEUCIPPE.
BOOK I.
BOOK II.
BOOK III.
BOOK IV.
BOOK V.
BOOK VI.
BOOK VII.
BOOK VIII.
PREFACE