SlideShare a Scribd company logo
‫قنبریان‬‫مهدیس‬
‫معرفی‬
‫ی‬ ‫نویس‬ ‫برنامه‬ ‫بان‬‫ز‬Java‫ا‬‫ر‬‫گ‬‫ی‬ ‫ش‬ ‫ه‬‫ر‬‫منظو‬ ‫چند‬ ‫بان‬‫ز‬ ‫یک‬
‫سال‬ ‫در‬ ‫سیستمز‬‫و‬‫مایکر‬ ‫سان‬ ‫شرکت‬ ‫در‬ ‫گاسلینگ‬ ‫جیمز‬ ‫توسط‬۱۹۹۵
‫اکل‬‫ر‬‫او‬‫گ‬‫ر‬‫بز‬ ‫شرکت‬
‫یا‬ ‫ساختار‬ ‫ی‬‫دار‬Syntax‫های‬ ‫بان‬‫ز‬ ‫مشابه‬C‫و‬++C
‫کمتر‬‫پایین‬‫سطح‬‫های‬‫قابلیت‬ ‫از‬‫پشتیبانی‬ ‫و‬‫تر‬‫ساده‬ ‫ایی‬‫ر‬‫گ‬ ‫ی‬ ‫ش‬
‫خودکار‬ ‫ت‬‫ر‬‫صو‬ ‫به‬ ‫حافظه‬ ‫مدیریت‬
‫باال‬ ‫امنیت‬
‫یک‬‫ایجاد‬Firewall‫شبکه‬‫و‬ ‫سیستم‬‫مابین‬
‫جالب‬ ‫شعار‬«Write once, Run anywhere»
‫برد‬‫ر‬‫کا‬
‫دنیا‬ ‫در‬‫ی‬ ‫نویس‬ ‫برنامه‬ ‫های‬ ‫بان‬‫ز‬ ‫ترین‬ ‫ف‬‫و‬‫معر‬‫از‬ ‫یکی‬
‫ی‬‫کامپیوتر‬ ‫های‬ ‫برنامه‬ ‫ساخت‬Enterprise‫ی‬‫تجار‬ ‫یا‬
‫تعاملی‬ ‫های‬ ‫سایت‬ ‫وب‬ ‫ای‬‫ر‬‫ب‬ ‫ی‬ ‫نویس‬ ‫برنامه‬
‫محبوب‬ ‫عامل‬ ‫سیستم‬ ‫ای‬‫ر‬‫ب‬ ‫اپلیکیشن‬ ‫توسعه‬ ‫اصلی‬ ‫های‬‫بان‬‫ز‬‫از‬ ‫یکی‬‫باز‬ ‫متن‬ ‫و‬
‫ید‬‫و‬‫اندر‬
‫جاوا‬‫ی‬‫مجاز‬‫ماشین‬
‫جاوا‬ ‫محبوب‬‫شعار‬
Bytecode
‫مفهوم‬Garbage Collection
‫امنیت‬ ‫تقاء‬‫ر‬‫ا‬ ‫ر‬‫منظو‬‫به‬ ‫هایی‬ ‫محدودیت‬
‫جاوا‬ ‫زبان‬ ‫با‬ ‫نویسی‬ ‫برنامه‬ ‫ابزارهای‬
‫یا‬ ‫نویسی‬ ‫برنامه‬ ‫یکپارچه‬ ‫توسعه‬ ‫های‬ ‫محیط‬IDE‫زیادی‬ ‫های‬
‫همچون‬Eclipse،IntelliJ IDEA‫و‬NetBeans
‫به‬ ‫نیاز‬ ‫جاوا‬ ‫نویسی‬ ‫برنامه‬ ‫محیط‬ ‫سازی‬ ‫آماده‬ ‫منظور‬ ‫به‬JRE
‫و‬JDK
‫گزینه‬ ،‫اکلیپس‬ ‫اصلی‬ ‫منوی‬ ‫در‬Windows‫زیرشاخه‬
Preferences
‫منوی‬ ،‫پنجره‬ ‫چپ‬ ‫قسمت‬ ‫در‬Java
‫واژه‬ ‫کنار‬ ‫رنگ‬ ‫مشکی‬ ‫مثلث‬ ‫روی‬ ‫کردن‬ ‫کلیک‬Java
‫گزینه‬ ،‫ها‬ ‫زیرشاخه‬ ‫میان‬ ‫از‬Installed JREs
‫جاوا‬ ‫ی‬ ‫نویس‬ ‫برنامه‬ ‫بان‬‫ز‬ ‫در‬ ‫ه‬‫ژ‬‫و‬‫پر‬ ‫اولین‬ ‫ساخت‬
‫ی‬‫منو‬ ‫از‬File‫گزینه‬New‫سپس‬Java Project
‫بخش‬ ‫در‬Project Name‫ه‬‫ژ‬‫و‬‫پر‬ ‫ای‬‫ر‬‫ب‬ ‫نام‬ ‫انتخاب‬
‫بخش‬ ‫در‬JRE‫گزینه‬‫و‬ ‫جاوا‬ ‫کدهای‬ ‫ای‬‫ر‬‫اج‬ ‫ای‬‫ر‬‫ب‬ ‫نظر‬ ‫مد‬‫نسخه‬Use and
execution environment JRE
‫بخش‬ ‫در‬Project Layout‫گزینه‬Create separate folders
for sources and class files
‫حالت‬ ‫در‬ ‫ها‬ ‫گزینه‬‫مابقی‬Default
‫گزینه‬Finish
‫ات‬‫ر‬‫سیا‬ ‫سایر‬ ‫ی‬‫و‬‫ر‬ ‫خود‬ ‫ن‬‫ز‬‫و‬ ‫محاسبه‬ ‫ی‬‫ه‬‫ژ‬‫و‬‫پر‬
‫جاوا‬ ‫اسکنر‬‫کالس‬‫از‬ ‫استفاده‬ ‫با‬ ‫ماهیانه‬‫آمد‬‫ر‬‫د‬ ‫محاسبه‬‫ه‬‫ژ‬‫و‬‫پر‬
‫یکدیگر‬‫کنار‬ ‫در‬ ‫شرطی‬ ‫ر‬‫دستو‬ ‫چندین‬ ‫از‬‫استفاده‬
‫س‬ ‫ات‬‫ر‬‫دستو‬ ‫در‬ ‫استرینگ‬ ‫کالس‬ ‫ی‬‫کارگیر‬ ‫به‬ ‫ی‬ ‫نحوه‬‫وییچ‬
‫جاوا‬ ‫بان‬‫ز‬ ‫در‬
‫ادر‬‫ر‬‫ب‬ ‫ی‬‫ه‬‫ژ‬‫و‬‫پر‬ ‫قالب‬‫در‬ ‫ها‬‫حلقه‬ ‫در‬ ‫جاوا‬ ‫ندوم‬‫ر‬‫کالس‬ ‫از‬ ‫استفاده‬
‫بدشانس‬
‫جاوا‬ ‫بان‬‫ز‬ ‫در‬ ‫کالس‬ ‫یک‬ ‫ی‬‫و‬‫ر‬ ‫از‬ ‫ی‬ ‫ش‬ ‫یک‬‫ساخت‬ ‫نحوه‬
‫جاوا‬ ‫بان‬‫ز‬ ‫در‬ ‫کالس‬ ‫یک‬ ‫ی‬‫و‬‫ر‬ ‫از‬ ‫ی‬ ‫ش‬ ‫یک‬‫ساخت‬ ‫نحوه‬
Cryptography
‫جاوا‬ ‫با‬‫امن‬‫ی‬ ‫نویس‬ ‫برنامه‬
 No pointers
 A bytecode verifier
 Fine-grained control over resource access
 A large number of library functions
‫جاوا‬ ‫امنیتی‬ ‫های‬‫کتابخانه‬
 The Java platform
 basic language
 library extensions
 Java Cryptography Extension (JCE)
 Java Secure Sockets Extension (JSSE)
 JAAS (Java Authentication and Authorization Service)
 JDK 1.4 also introduces two new functions:
 JGSS (Java General Security Service)
 CertPath API (Java Certification Path API)
 third-party library (Provider)
 Bouncy Castle provider
Message digests
 A function that ensures the integrity of a message
 Represents the fingerprint of the message
 A one-way function
 Can be
 Weak: checksum
 Strong: use hashing
 JDK 1.4 supports the following message-digest
algorithms:
 MD2 and MD5 , which are 128-bit algorithms
 SHA-1, which is a 160-bit algorithm
 SHA-256,SHA-383, and SHA-512, which offer longer
fingerprint sizes of 256, 383, and 512 bits, respectively
Message digests
 The MessageDigest class manipulates message
digests
 MessageDigest.getInstance("MD5“)
 Creates the message digest
 .update(plaintext)
 Calculates the message digest with a plaintext string
 .digest()
 Reads the message digest
Private Key Cryptography
 To ensure the confidentiality of a message
 JDK 1.4 supports the following private key
algorithms:
 DES (Data Encryption Standard) a 56-bit block cipher.
 TripleDES. two keys, giving an effective key strength of
112 bits
 AES (Advanced Encryption Standard) a 128-bit block
cipher with key lengths of 128, 192, or 256 bits.
 RC2,RC4, and RC5
 Blowfish
 PBE (Password Based Encryption)
Private Key Cryptography
 KeyGenerator.getInstance("DES") , .init(56) , and
.generateKey()
 Generates the key
 Cipher.getInstance("DES/ECB/PKCS5Padding")
 Creates the Cipher object (specifying the algorithm, mode, and
padding)
 .init(Cipher.ENCRYPT_MODE, key)
 Initializes the Cipher object
 .doFinal(plainText)
 Calculates the ciphertext with a plaintext string
 .init(Cipher.DECRYPT_MODE, key)
 Decrypts the ciphertext
 .doFinal(cipherText)
 Computes the ciphertext
Public Key Cryptography
 solves the problem of encrypting messages between
two parties without prior agreement on the key
 The following two algorithms are used in public key
encryption:
 RSA
 Diffie-Hellman
Public Key Cryptography
 KeyPairGenerator.getInstance("RSA") , .initialize(1024) , and
.generateKeyPair()
 Generates the key pair
 Cipher.getInstance("RSA/ECB/PKCS1Padding")
 Creates a Cipher object (specifying the algorithm, mode, and
padding)
 .init(Cipher.ENCRYPT_MODE, key.getPublic())
 Initializes the Cipher object
 .doFinal(plainText)
 Calculates the ciphertext with a plaintext string
 .init(Cipher.DECRYPT_MODE, key.getPrivate()) and
.doFinal(cipherText)
 Decrypts the ciphertext
Digital Signatures
 solves a Man-in-the-Middle attack
 a bit pattern that proves that a message came from a
given party
 using the reverse of the public key process with message
digest
 do not provide encryption of the message
 JDK 1.4 supports the following digital signature
algorithms:
 MD2/RSA
 MD5/RSA
 SHA1/DSA
 SHA1/RSA
Digital Signatures
 KeyPairGenerator.getInstance("RSA") , .initialize(1024) , and
.generateKeyPair()
 Generates the keys
 Cipher.getInstance("MD5WithRSA")
 Creates the Signature object
 .initSign(key.getPrivate())
 Initializes the Signature object
 .update(plainText) and .sign()
 Calculates the signature with a plaintext string
 .initVerify(key.getPublic()) and .verify(signature)
 Verifies the signature
BigInteger
 The java.math.BigInteger class
 modular arithmetic
 GCD calculation
 primality testing
 prime generation
 bit manipulation
java.math.BigInteger.gcd
java.math.BigInteger.multiply
java.math.BigInteger.mod
java.math.BigInteger.modInverse
java.math.BigInteger.probablePrime
Congruence relation

More Related Content

Similar to Java

پاورپوینت زبان برنامه نویسی پایتون.pptx
پاورپوینت زبان برنامه نویسی پایتون.pptxپاورپوینت زبان برنامه نویسی پایتون.pptx
پاورپوینت زبان برنامه نویسی پایتون.pptx
padparsa1388
 
Softwares : Vuln discovery , attack and deffence technologies
Softwares : Vuln discovery , attack and deffence technologiesSoftwares : Vuln discovery , attack and deffence technologies
Softwares : Vuln discovery , attack and deffence technologies
hamid.k
 
اسلاید های شروع برنامه نویسی اندروید با جاوا - مهندس سید وحید هاشمی
اسلاید های شروع برنامه نویسی اندروید با جاوا - مهندس سید وحید هاشمیاسلاید های شروع برنامه نویسی اندروید با جاوا - مهندس سید وحید هاشمی
اسلاید های شروع برنامه نویسی اندروید با جاوا - مهندس سید وحید هاشمی
Vahid Hashemi
 
.NetFramework
.NetFramework.NetFramework
.NetFramework
Farhad Karimzadeh
 
M.nemati ssl&tls
M.nemati ssl&tls M.nemati ssl&tls
M.nemati ssl&tls
rezgarnemati
 
Introduction to oracle
Introduction to oracleIntroduction to oracle
Introduction to oracle
Ehsan Hamzei
 
Authentication
AuthenticationAuthentication
Authenticationpeykanpour
 
Authentication
AuthenticationAuthentication
Authenticationpeykanpour
 
Authentication
AuthenticationAuthentication
Authenticationpeykanpour
 
Authentication
AuthenticationAuthentication
Authenticationpeykanpour
 
Amniat
AmniatAmniat
Io t slide
Io t slideIo t slide
Io t slide
Alireza abdeshah
 
مروی بر استارترکیتها و پلتفرمهای اینترنت اشیاء
مروی بر استارترکیتها و پلتفرمهای اینترنت اشیاءمروی بر استارترکیتها و پلتفرمهای اینترنت اشیاء
مروی بر استارترکیتها و پلتفرمهای اینترنت اشیاء
startupIoT
 
Data Management System- Haseb System Co
Data Management System- Haseb System CoData Management System- Haseb System Co
Data Management System- Haseb System Co
Hamed Ghazanfari
 
Kotlin
KotlinKotlin
Ssh edition 2
Ssh edition 2Ssh edition 2
Ssh edition 2
Yashar Esmaildokht
 
Ssh
SshSsh
مفاهیم اولیه داکر
مفاهیم اولیه داکرمفاهیم اولیه داکر
مفاهیم اولیه داکر
Ali Rasoulian
 
Javascript
JavascriptJavascript
Javascript
javadboroji
 

Similar to Java (20)

پاورپوینت زبان برنامه نویسی پایتون.pptx
پاورپوینت زبان برنامه نویسی پایتون.pptxپاورپوینت زبان برنامه نویسی پایتون.pptx
پاورپوینت زبان برنامه نویسی پایتون.pptx
 
Softwares : Vuln discovery , attack and deffence technologies
Softwares : Vuln discovery , attack and deffence technologiesSoftwares : Vuln discovery , attack and deffence technologies
Softwares : Vuln discovery , attack and deffence technologies
 
اسلاید های شروع برنامه نویسی اندروید با جاوا - مهندس سید وحید هاشمی
اسلاید های شروع برنامه نویسی اندروید با جاوا - مهندس سید وحید هاشمیاسلاید های شروع برنامه نویسی اندروید با جاوا - مهندس سید وحید هاشمی
اسلاید های شروع برنامه نویسی اندروید با جاوا - مهندس سید وحید هاشمی
 
.NetFramework
.NetFramework.NetFramework
.NetFramework
 
M.nemati ssl&tls
M.nemati ssl&tls M.nemati ssl&tls
M.nemati ssl&tls
 
Introduction to oracle
Introduction to oracleIntroduction to oracle
Introduction to oracle
 
Authentication
AuthenticationAuthentication
Authentication
 
Authentication
AuthenticationAuthentication
Authentication
 
Authentication
AuthenticationAuthentication
Authentication
 
Authentication
AuthenticationAuthentication
Authentication
 
Amniat
AmniatAmniat
Amniat
 
MongoDB
MongoDBMongoDB
MongoDB
 
Io t slide
Io t slideIo t slide
Io t slide
 
مروی بر استارترکیتها و پلتفرمهای اینترنت اشیاء
مروی بر استارترکیتها و پلتفرمهای اینترنت اشیاءمروی بر استارترکیتها و پلتفرمهای اینترنت اشیاء
مروی بر استارترکیتها و پلتفرمهای اینترنت اشیاء
 
Data Management System- Haseb System Co
Data Management System- Haseb System CoData Management System- Haseb System Co
Data Management System- Haseb System Co
 
Kotlin
KotlinKotlin
Kotlin
 
Ssh edition 2
Ssh edition 2Ssh edition 2
Ssh edition 2
 
Ssh
SshSsh
Ssh
 
مفاهیم اولیه داکر
مفاهیم اولیه داکرمفاهیم اولیه داکر
مفاهیم اولیه داکر
 
Javascript
JavascriptJavascript
Javascript
 

Java

  • 2. ‫معرفی‬ ‫ی‬ ‫نویس‬ ‫برنامه‬ ‫بان‬‫ز‬Java‫ا‬‫ر‬‫گ‬‫ی‬ ‫ش‬ ‫ه‬‫ر‬‫منظو‬ ‫چند‬ ‫بان‬‫ز‬ ‫یک‬ ‫سال‬ ‫در‬ ‫سیستمز‬‫و‬‫مایکر‬ ‫سان‬ ‫شرکت‬ ‫در‬ ‫گاسلینگ‬ ‫جیمز‬ ‫توسط‬۱۹۹۵ ‫اکل‬‫ر‬‫او‬‫گ‬‫ر‬‫بز‬ ‫شرکت‬ ‫یا‬ ‫ساختار‬ ‫ی‬‫دار‬Syntax‫های‬ ‫بان‬‫ز‬ ‫مشابه‬C‫و‬++C ‫کمتر‬‫پایین‬‫سطح‬‫های‬‫قابلیت‬ ‫از‬‫پشتیبانی‬ ‫و‬‫تر‬‫ساده‬ ‫ایی‬‫ر‬‫گ‬ ‫ی‬ ‫ش‬ ‫خودکار‬ ‫ت‬‫ر‬‫صو‬ ‫به‬ ‫حافظه‬ ‫مدیریت‬ ‫باال‬ ‫امنیت‬ ‫یک‬‫ایجاد‬Firewall‫شبکه‬‫و‬ ‫سیستم‬‫مابین‬ ‫جالب‬ ‫شعار‬«Write once, Run anywhere»
  • 3. ‫برد‬‫ر‬‫کا‬ ‫دنیا‬ ‫در‬‫ی‬ ‫نویس‬ ‫برنامه‬ ‫های‬ ‫بان‬‫ز‬ ‫ترین‬ ‫ف‬‫و‬‫معر‬‫از‬ ‫یکی‬ ‫ی‬‫کامپیوتر‬ ‫های‬ ‫برنامه‬ ‫ساخت‬Enterprise‫ی‬‫تجار‬ ‫یا‬ ‫تعاملی‬ ‫های‬ ‫سایت‬ ‫وب‬ ‫ای‬‫ر‬‫ب‬ ‫ی‬ ‫نویس‬ ‫برنامه‬ ‫محبوب‬ ‫عامل‬ ‫سیستم‬ ‫ای‬‫ر‬‫ب‬ ‫اپلیکیشن‬ ‫توسعه‬ ‫اصلی‬ ‫های‬‫بان‬‫ز‬‫از‬ ‫یکی‬‫باز‬ ‫متن‬ ‫و‬ ‫ید‬‫و‬‫اندر‬
  • 5. ‫جاوا‬ ‫زبان‬ ‫با‬ ‫نویسی‬ ‫برنامه‬ ‫ابزارهای‬ ‫یا‬ ‫نویسی‬ ‫برنامه‬ ‫یکپارچه‬ ‫توسعه‬ ‫های‬ ‫محیط‬IDE‫زیادی‬ ‫های‬ ‫همچون‬Eclipse،IntelliJ IDEA‫و‬NetBeans ‫به‬ ‫نیاز‬ ‫جاوا‬ ‫نویسی‬ ‫برنامه‬ ‫محیط‬ ‫سازی‬ ‫آماده‬ ‫منظور‬ ‫به‬JRE ‫و‬JDK ‫گزینه‬ ،‫اکلیپس‬ ‫اصلی‬ ‫منوی‬ ‫در‬Windows‫زیرشاخه‬ Preferences ‫منوی‬ ،‫پنجره‬ ‫چپ‬ ‫قسمت‬ ‫در‬Java ‫واژه‬ ‫کنار‬ ‫رنگ‬ ‫مشکی‬ ‫مثلث‬ ‫روی‬ ‫کردن‬ ‫کلیک‬Java ‫گزینه‬ ،‫ها‬ ‫زیرشاخه‬ ‫میان‬ ‫از‬Installed JREs
  • 6. ‫جاوا‬ ‫ی‬ ‫نویس‬ ‫برنامه‬ ‫بان‬‫ز‬ ‫در‬ ‫ه‬‫ژ‬‫و‬‫پر‬ ‫اولین‬ ‫ساخت‬ ‫ی‬‫منو‬ ‫از‬File‫گزینه‬New‫سپس‬Java Project ‫بخش‬ ‫در‬Project Name‫ه‬‫ژ‬‫و‬‫پر‬ ‫ای‬‫ر‬‫ب‬ ‫نام‬ ‫انتخاب‬ ‫بخش‬ ‫در‬JRE‫گزینه‬‫و‬ ‫جاوا‬ ‫کدهای‬ ‫ای‬‫ر‬‫اج‬ ‫ای‬‫ر‬‫ب‬ ‫نظر‬ ‫مد‬‫نسخه‬Use and execution environment JRE ‫بخش‬ ‫در‬Project Layout‫گزینه‬Create separate folders for sources and class files ‫حالت‬ ‫در‬ ‫ها‬ ‫گزینه‬‫مابقی‬Default ‫گزینه‬Finish
  • 7. ‫ات‬‫ر‬‫سیا‬ ‫سایر‬ ‫ی‬‫و‬‫ر‬ ‫خود‬ ‫ن‬‫ز‬‫و‬ ‫محاسبه‬ ‫ی‬‫ه‬‫ژ‬‫و‬‫پر‬
  • 8. ‫جاوا‬ ‫اسکنر‬‫کالس‬‫از‬ ‫استفاده‬ ‫با‬ ‫ماهیانه‬‫آمد‬‫ر‬‫د‬ ‫محاسبه‬‫ه‬‫ژ‬‫و‬‫پر‬
  • 9. ‫یکدیگر‬‫کنار‬ ‫در‬ ‫شرطی‬ ‫ر‬‫دستو‬ ‫چندین‬ ‫از‬‫استفاده‬
  • 10. ‫س‬ ‫ات‬‫ر‬‫دستو‬ ‫در‬ ‫استرینگ‬ ‫کالس‬ ‫ی‬‫کارگیر‬ ‫به‬ ‫ی‬ ‫نحوه‬‫وییچ‬ ‫جاوا‬ ‫بان‬‫ز‬ ‫در‬
  • 11. ‫ادر‬‫ر‬‫ب‬ ‫ی‬‫ه‬‫ژ‬‫و‬‫پر‬ ‫قالب‬‫در‬ ‫ها‬‫حلقه‬ ‫در‬ ‫جاوا‬ ‫ندوم‬‫ر‬‫کالس‬ ‫از‬ ‫استفاده‬ ‫بدشانس‬
  • 12. ‫جاوا‬ ‫بان‬‫ز‬ ‫در‬ ‫کالس‬ ‫یک‬ ‫ی‬‫و‬‫ر‬ ‫از‬ ‫ی‬ ‫ش‬ ‫یک‬‫ساخت‬ ‫نحوه‬
  • 13. ‫جاوا‬ ‫بان‬‫ز‬ ‫در‬ ‫کالس‬ ‫یک‬ ‫ی‬‫و‬‫ر‬ ‫از‬ ‫ی‬ ‫ش‬ ‫یک‬‫ساخت‬ ‫نحوه‬
  • 15. ‫جاوا‬ ‫با‬‫امن‬‫ی‬ ‫نویس‬ ‫برنامه‬  No pointers  A bytecode verifier  Fine-grained control over resource access  A large number of library functions
  • 16. ‫جاوا‬ ‫امنیتی‬ ‫های‬‫کتابخانه‬  The Java platform  basic language  library extensions  Java Cryptography Extension (JCE)  Java Secure Sockets Extension (JSSE)  JAAS (Java Authentication and Authorization Service)  JDK 1.4 also introduces two new functions:  JGSS (Java General Security Service)  CertPath API (Java Certification Path API)  third-party library (Provider)  Bouncy Castle provider
  • 17. Message digests  A function that ensures the integrity of a message  Represents the fingerprint of the message  A one-way function  Can be  Weak: checksum  Strong: use hashing  JDK 1.4 supports the following message-digest algorithms:  MD2 and MD5 , which are 128-bit algorithms  SHA-1, which is a 160-bit algorithm  SHA-256,SHA-383, and SHA-512, which offer longer fingerprint sizes of 256, 383, and 512 bits, respectively
  • 18. Message digests  The MessageDigest class manipulates message digests  MessageDigest.getInstance("MD5“)  Creates the message digest  .update(plaintext)  Calculates the message digest with a plaintext string  .digest()  Reads the message digest
  • 19.
  • 20. Private Key Cryptography  To ensure the confidentiality of a message  JDK 1.4 supports the following private key algorithms:  DES (Data Encryption Standard) a 56-bit block cipher.  TripleDES. two keys, giving an effective key strength of 112 bits  AES (Advanced Encryption Standard) a 128-bit block cipher with key lengths of 128, 192, or 256 bits.  RC2,RC4, and RC5  Blowfish  PBE (Password Based Encryption)
  • 21. Private Key Cryptography  KeyGenerator.getInstance("DES") , .init(56) , and .generateKey()  Generates the key  Cipher.getInstance("DES/ECB/PKCS5Padding")  Creates the Cipher object (specifying the algorithm, mode, and padding)  .init(Cipher.ENCRYPT_MODE, key)  Initializes the Cipher object  .doFinal(plainText)  Calculates the ciphertext with a plaintext string  .init(Cipher.DECRYPT_MODE, key)  Decrypts the ciphertext  .doFinal(cipherText)  Computes the ciphertext
  • 22. Public Key Cryptography  solves the problem of encrypting messages between two parties without prior agreement on the key  The following two algorithms are used in public key encryption:  RSA  Diffie-Hellman
  • 23. Public Key Cryptography  KeyPairGenerator.getInstance("RSA") , .initialize(1024) , and .generateKeyPair()  Generates the key pair  Cipher.getInstance("RSA/ECB/PKCS1Padding")  Creates a Cipher object (specifying the algorithm, mode, and padding)  .init(Cipher.ENCRYPT_MODE, key.getPublic())  Initializes the Cipher object  .doFinal(plainText)  Calculates the ciphertext with a plaintext string  .init(Cipher.DECRYPT_MODE, key.getPrivate()) and .doFinal(cipherText)  Decrypts the ciphertext
  • 24. Digital Signatures  solves a Man-in-the-Middle attack  a bit pattern that proves that a message came from a given party  using the reverse of the public key process with message digest  do not provide encryption of the message  JDK 1.4 supports the following digital signature algorithms:  MD2/RSA  MD5/RSA  SHA1/DSA  SHA1/RSA
  • 25. Digital Signatures  KeyPairGenerator.getInstance("RSA") , .initialize(1024) , and .generateKeyPair()  Generates the keys  Cipher.getInstance("MD5WithRSA")  Creates the Signature object  .initSign(key.getPrivate())  Initializes the Signature object  .update(plainText) and .sign()  Calculates the signature with a plaintext string  .initVerify(key.getPublic()) and .verify(signature)  Verifies the signature
  • 26. BigInteger  The java.math.BigInteger class  modular arithmetic  GCD calculation  primality testing  prime generation  bit manipulation