Public Key CryptographyPublic Key Cryptography
Martin Kobetic
Cincom Smalltalk Development
ESUG 2006
Public Key Algorithms
Encryption (RSA)
Key Establishment (RSA, DH)
Signing
Hashes (SHA, MD5)
MACs (HMAC, CBC-MAC)
Digital Signatures (RSA, DSA)
public and private key
hard to compute private from the public
sparse key space => much longer keys
based on hard problems
factoring, discrete logarithm
much slower
RSA, DSA, DH, ElGamal
elliptic curves: ECDSA, ECDH,
provides:
confidentiality
symmetric (secret) key ciphers
same (secret) key => encrypt and decrypt
DES, AES, RC4
asymmetric (public) key ciphers
public key => encrypt
private key => decrypt
RSA,ElGammal
RSA Security, PKCS #1
modulus n = product of 2 large primes p, q
public: e = relatively prime to (p-1)(q-1)
private: d = e-1 mod ((p-1)(q-1))
C = Pe mod n [ P < n ]
P = Cd mod n
small e => faster encryption
keys := RSAKeyGenerator keySize: 512.
alice := RSA new publicKey: keys publicKey.
ctxt := alice encrypt: 'Hello World' asByteArray.
ctxt asHexString
bob := RSA new privateKey: keys privateKey.
(bob decrypt: ctxt) asString
keys := RSAKeyGenerator keySize: 512.
alice := RSA new publicKey: keys publicKey.
msg := 'Hello World' asByteArrayEncoding: # utf8.
msg := alice encrypt: msg.
bob := RSA new privateKey: keys privateKey.
msg := bob decrypt: msg.
msg asStringEncoding: # utf8
public key too slow for bulk encryption
public key => secure symmetric key
symmetric key => bulk encryption
key exchange (RSA)
generate one-time symmetric key
public key => encrypt the symmetric key
key agreement (DH)
parties cooperate to generate a shared secret
key := DSSRandom default byteStream next: 40.
msg := 'Hello World!' asByteArray.
msg := (ARC4 key: key) encrypt: msg.
alice := RSA new publicKey: keys publicKey.
key := alice encrypt: key.
bob := RSA new privateKey: keys privateKey.
key := bob decrypt: key
((ARC4 key: key) decrypt: msg) asString.
shared secret over unprotected channel
http://www.ietf.org/rfc/rfc2631.txt
modulus p: large prime (>=512b)
order q: large prime (>=160b)
generator g: order q mod p
private x: random 1 < x < q - 1
public y: g^ x mod p
public y : other party s y = g^ x (mod p)
shared secret: y ^ x = y^ x (mod p)
gen := DHParameterGenerator m: 160 l: 512.
alice := DH p: gen p q: gen q g: gen g.
ya := alice publicValue.
bob := DH p: alice p q: alice q g: alice g.
yb := bob publicValue.
ss := bob sharedSecretUsing: ya
ss = (alice sharedSecretUsing: yb)
bob := DH newFrom: gen.
yb := bob publicValue.
alice := DH newFrom: gen.
ya := alice publicValue.
ss := (alice sharedSecretUsing: yb) asByteArray.
msg := 'Hello World!' asByteArray.
msg := (ARC4 key: ss) encrypt: msg.
ss := (bob sharedSecretUsing: ya) asByteArray.
((ARC4 key: ss) decrypt: msg) asString.
Provides:
integrity (tamper evidence)
authentication
non-repudiation
Hashes (SHA, MD5)
Digital Signatures (RSA, DSA)
provides:
data fingerprinting
unlimited input size => fixed output size
must be:
one-way: h(m) => m
collision resistant: m1,m2 => h(m1) = h(m2)
MD2, MD4, MD5, SHA, RIPE-MD
compression function:
M = M1, M2,
hi = f(Mi, hi-1)
MD-strengthening:
include message length (in the padding)
doesn t completely prevent length extension
http://www.ietf.org/rfc/rfc1321.txt
(Ron Rivest)
digest: 128-bits (16B)
block: 512-bits (64B)
padding: M | 10...0 | length (64bits)
broken in 2004, avoid MD5!
(MD5 hash: 'Hello' asByteArray) asHexString
(MD5 hash: # [1 2 3 4 5] from: 2 to: 4) asHexString
input := # [1 2 3 4 5 6 7 8 9] readStream.
(MD5 hashNext: 3 from: input) asHexString
(MD5 hashFrom: input) asHexString
SHS - NIST FIPS PUB 180
digest: 160 bits (20B)
block: 512 bits (64B)
padding: M | 10...0 | length (64bits)
FIPS 180-1: SHA-1 (1995)
FIPS 180-2: SHA-256, 384, 512 (2002)
SHA-1 broken in 2005!
input := 'Hello World!' asByteArray readStream.
sha := SHA new.
sha updateWithNext: 5 from: input.
sha digest asHexString.
sha updateFrom: input.
sha digest asHexString.
input reset.
(SHA256 hashFrom: input) asHexString.
authentic, non-reusable, unalterable
signing
uses the private key
message, key => signature
verification
uses the public key
message, key, signature => true/false
signing:
hash the plaintext
encode digest
encrypt digest with private key
verifying:
decrypt digest with public key
decode digest
hash the plaintext
compare the digests
alice := RSA new privateKey: keys privateKey.
msg := 'Hello World' asByteArray.
sig := alice sign: msg.
sig asHexString
bob := RSA new publicKey: keys publicKey.
bob verify: sig of: msg
NIST FIPS PUB 186
p prime (modulus): (512 + k* 64 <= 1024)
q prime factor of p 1 (160 bits)
g > 1; g^ q mod p = 1 (g has order q mod p)
x < q (private key)
y = g^ x mod p (public key)
FIPS 186-1 (1998): RSA(X9.31)
FIPS 186-2 (2001): ECDSA(X9.62)
FIPS 186-3 (?2006): bigger keys up to 15K bits
keys := DSAKeyGenerator keySize: 512.
alice := DSA new privateKey: keys privateKey.
sig := alice sign: 'Hello World' asByteArray
bob := DSA new publicKey: keys publicKey.
bob verify: sig of: 'Hello World' asByteArray
[1] Anderson: Security Engineering
[2] Ferguson, Schneier:
Practical Cryptography
[3] Kahn: The Codebreakers
[4] Menezes, van Oorschot, Vanstone:
Handbook of Applied Cryptography
[5] Schneier: Applied Cryptography

More Related Content

PDF
AREA41 - Anatomy of attacks aimed at financial sector by the Lazarus group
PDF
Cryptography for Smalltalkers
PPTX
State of the art logging
PDF
SCaLE 2016 - syslog-ng: From Raw Data to Big Data
PDF
VisualWorks Security Reloaded - STIC 2012
PDF
syslog-ng: from log collection to processing and information extraction
PDF
2015. Libre Software Meeting - syslog-ng: from log collection to processing a...
PDF
LOADays 2015 - syslog-ng - from log collection to processing and infomation e...
AREA41 - Anatomy of attacks aimed at financial sector by the Lazarus group
Cryptography for Smalltalkers
State of the art logging
SCaLE 2016 - syslog-ng: From Raw Data to Big Data
VisualWorks Security Reloaded - STIC 2012
syslog-ng: from log collection to processing and information extraction
2015. Libre Software Meeting - syslog-ng: from log collection to processing a...
LOADays 2015 - syslog-ng - from log collection to processing and infomation e...

What's hot (20)

PDF
Apache Commons ソースリーディングの会:Codec
PDF
0 to 31337 Real Quick: Lessons Learned by Reversing the Flare-On Challenge
PDF
Native or External?
PPTX
Blockchain Cryptography for Developers (Nakov @ BGWebSummit 2018)
PPTX
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
PDF
Redis - for duplicate detection on real time stream
PPTX
“Technical Intro to Blockhain” by Yurijs Pimenovs from Paybis at CryptoCurren...
PDF
Paris Redis Meetup Introduction
PPTX
Cybersecurity cyberlab3
PPTX
Blockchain Cryptography for Developers (Nakov @ BlockWorld 2018, San Jose)
PPTX
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
PDF
Centralized Logging with syslog
PPTX
Cryptography for Absolute Beginners (May 2019)
PPTX
Monero Presentation by Justin Ehrenhofer - Stockholm, Sweden 2017
PPTX
Monero Presentation by Justin Ehrenhofer - Copenhagen, Denmark 2017
PDF
RedisConf17 - Redis as a JSON document store
PDF
Redis — The AK-47 of Post-relational Databases
PDF
Password Storage And Attacking In PHP - PHP Argentina
PPTX
Monero Presentation by Justin Ehrenhofer - Oslo, Norway 2017
PDF
Password Storage and Attacking in PHP
Apache Commons ソースリーディングの会:Codec
0 to 31337 Real Quick: Lessons Learned by Reversing the Flare-On Challenge
Native or External?
Blockchain Cryptography for Developers (Nakov @ BGWebSummit 2018)
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
Redis - for duplicate detection on real time stream
“Technical Intro to Blockhain” by Yurijs Pimenovs from Paybis at CryptoCurren...
Paris Redis Meetup Introduction
Cybersecurity cyberlab3
Blockchain Cryptography for Developers (Nakov @ BlockWorld 2018, San Jose)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Centralized Logging with syslog
Cryptography for Absolute Beginners (May 2019)
Monero Presentation by Justin Ehrenhofer - Stockholm, Sweden 2017
Monero Presentation by Justin Ehrenhofer - Copenhagen, Denmark 2017
RedisConf17 - Redis as a JSON document store
Redis — The AK-47 of Post-relational Databases
Password Storage And Attacking In PHP - PHP Argentina
Monero Presentation by Justin Ehrenhofer - Oslo, Norway 2017
Password Storage and Attacking in PHP
Ad

Viewers also liked (6)

PDF
Tide - The missing web framework
PDF
Voyage by example
PDF
Advanced Seaside
PDF
MongoTalk/Voyage
PDF
Why do *you* need a strong open-source Smalltalk!
PDF
Make It Better Together: コミュニティを主体としたLibreOffice翻訳 / : Community-centered Lib...
Tide - The missing web framework
Voyage by example
Advanced Seaside
MongoTalk/Voyage
Why do *you* need a strong open-source Smalltalk!
Make It Better Together: コミュニティを主体としたLibreOffice翻訳 / : Community-centered Lib...
Ad

Similar to Cryptography for Smalltalkers 2 (20)

PPT
Cryptography for Smalltalkers 2 - ESUG 2006
PPT
Cryptography and SSL in Smalltalk - StS 2003
PPT
introduction to cryptography
PPT
crypto1.ppt
PPT
crypto.ppt
PPT
introduction to cryptography (basics of it)
PPT
needed.ppt
PPT
PPTX
Django cryptography
PDF
Everything I always wanted to know about crypto, but never thought I'd unders...
PDF
Python Cryptography & Security
PDF
TLS/SSL Internet Security Talk
PPTX
Hashfunction
PPTX
Hashfunction
PPTX
Hash function
PPTX
Hashfunction
PPTX
Hashfunction
PPTX
Hashfunction
PPTX
Hashfunction
Cryptography for Smalltalkers 2 - ESUG 2006
Cryptography and SSL in Smalltalk - StS 2003
introduction to cryptography
crypto1.ppt
crypto.ppt
introduction to cryptography (basics of it)
needed.ppt
Django cryptography
Everything I always wanted to know about crypto, but never thought I'd unders...
Python Cryptography & Security
TLS/SSL Internet Security Talk
Hashfunction
Hashfunction
Hash function
Hashfunction
Hashfunction
Hashfunction
Hashfunction

More from ESUG (20)

PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
PDF
Directing Generative AI for Pharo Documentation
PDF
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
PDF
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
PDF
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
PDF
Analysing Python Machine Learning Notebooks with Moose
PDF
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
PDF
Package-Aware Approach for Repository-Level Code Completion in Pharo
PDF
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
PDF
An Analysis of Inline Method Refactoring
PDF
Identification of unnecessary object allocations using static escape analysis
PDF
Control flow-sensitive optimizations In the Druid Meta-Compiler
PDF
Clean Blocks (IWST 2025, Gdansk, Poland)
PDF
Encoding for Objects Matters (IWST 2025)
PDF
Challenges of Transpiling Smalltalk to JavaScript
PDF
Immersive experiences: what Pharo users do!
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
PDF
Cavrois - an Organic Window Management (ESUG 2025)
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
Micromaid: A simple Mermaid-like chart generator for Pharo
Directing Generative AI for Pharo Documentation
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
Analysing Python Machine Learning Notebooks with Moose
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
Package-Aware Approach for Repository-Level Code Completion in Pharo
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
An Analysis of Inline Method Refactoring
Identification of unnecessary object allocations using static escape analysis
Control flow-sensitive optimizations In the Druid Meta-Compiler
Clean Blocks (IWST 2025, Gdansk, Poland)
Encoding for Objects Matters (IWST 2025)
Challenges of Transpiling Smalltalk to JavaScript
Immersive experiences: what Pharo users do!
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
Cavrois - an Organic Window Management (ESUG 2025)

Recently uploaded (20)

PDF
The influence of sentiment analysis in enhancing early warning system model f...
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
DOCX
search engine optimization ppt fir known well about this
PDF
STKI Israel Market Study 2025 version august
PPTX
Microsoft Excel 365/2024 Beginner's training
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPT
What is a Computer? Input Devices /output devices
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
The influence of sentiment analysis in enhancing early warning system model f...
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Flame analysis and combustion estimation using large language and vision assi...
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
search engine optimization ppt fir known well about this
STKI Israel Market Study 2025 version august
Microsoft Excel 365/2024 Beginner's training
Enhancing emotion recognition model for a student engagement use case through...
OpenACC and Open Hackathons Monthly Highlights July 2025
Final SEM Unit 1 for mit wpu at pune .pptx
1 - Historical Antecedents, Social Consideration.pdf
What is a Computer? Input Devices /output devices
A contest of sentiment analysis: k-nearest neighbor versus neural network
Hindi spoken digit analysis for native and non-native speakers
NewMind AI Weekly Chronicles – August ’25 Week III
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Chapter 5: Probability Theory and Statistics
Taming the Chaos: How to Turn Unstructured Data into Decisions
Convolutional neural network based encoder-decoder for efficient real-time ob...

Cryptography for Smalltalkers 2

  • 1. Public Key CryptographyPublic Key Cryptography Martin Kobetic Cincom Smalltalk Development ESUG 2006
  • 2. Public Key Algorithms Encryption (RSA) Key Establishment (RSA, DH) Signing Hashes (SHA, MD5) MACs (HMAC, CBC-MAC) Digital Signatures (RSA, DSA)
  • 3. public and private key hard to compute private from the public sparse key space => much longer keys based on hard problems factoring, discrete logarithm much slower RSA, DSA, DH, ElGamal elliptic curves: ECDSA, ECDH,
  • 4. provides: confidentiality symmetric (secret) key ciphers same (secret) key => encrypt and decrypt DES, AES, RC4 asymmetric (public) key ciphers public key => encrypt private key => decrypt RSA,ElGammal
  • 5. RSA Security, PKCS #1 modulus n = product of 2 large primes p, q public: e = relatively prime to (p-1)(q-1) private: d = e-1 mod ((p-1)(q-1)) C = Pe mod n [ P < n ] P = Cd mod n small e => faster encryption
  • 6. keys := RSAKeyGenerator keySize: 512. alice := RSA new publicKey: keys publicKey. ctxt := alice encrypt: 'Hello World' asByteArray. ctxt asHexString bob := RSA new privateKey: keys privateKey. (bob decrypt: ctxt) asString
  • 7. keys := RSAKeyGenerator keySize: 512. alice := RSA new publicKey: keys publicKey. msg := 'Hello World' asByteArrayEncoding: # utf8. msg := alice encrypt: msg. bob := RSA new privateKey: keys privateKey. msg := bob decrypt: msg. msg asStringEncoding: # utf8
  • 8. public key too slow for bulk encryption public key => secure symmetric key symmetric key => bulk encryption key exchange (RSA) generate one-time symmetric key public key => encrypt the symmetric key key agreement (DH) parties cooperate to generate a shared secret
  • 9. key := DSSRandom default byteStream next: 40. msg := 'Hello World!' asByteArray. msg := (ARC4 key: key) encrypt: msg. alice := RSA new publicKey: keys publicKey. key := alice encrypt: key. bob := RSA new privateKey: keys privateKey. key := bob decrypt: key ((ARC4 key: key) decrypt: msg) asString.
  • 10. shared secret over unprotected channel http://www.ietf.org/rfc/rfc2631.txt modulus p: large prime (>=512b) order q: large prime (>=160b) generator g: order q mod p private x: random 1 < x < q - 1 public y: g^ x mod p public y : other party s y = g^ x (mod p) shared secret: y ^ x = y^ x (mod p)
  • 11. gen := DHParameterGenerator m: 160 l: 512. alice := DH p: gen p q: gen q g: gen g. ya := alice publicValue. bob := DH p: alice p q: alice q g: alice g. yb := bob publicValue. ss := bob sharedSecretUsing: ya ss = (alice sharedSecretUsing: yb)
  • 12. bob := DH newFrom: gen. yb := bob publicValue. alice := DH newFrom: gen. ya := alice publicValue. ss := (alice sharedSecretUsing: yb) asByteArray. msg := 'Hello World!' asByteArray. msg := (ARC4 key: ss) encrypt: msg. ss := (bob sharedSecretUsing: ya) asByteArray. ((ARC4 key: ss) decrypt: msg) asString.
  • 14. provides: data fingerprinting unlimited input size => fixed output size must be: one-way: h(m) => m collision resistant: m1,m2 => h(m1) = h(m2) MD2, MD4, MD5, SHA, RIPE-MD
  • 15. compression function: M = M1, M2, hi = f(Mi, hi-1) MD-strengthening: include message length (in the padding) doesn t completely prevent length extension
  • 16. http://www.ietf.org/rfc/rfc1321.txt (Ron Rivest) digest: 128-bits (16B) block: 512-bits (64B) padding: M | 10...0 | length (64bits) broken in 2004, avoid MD5!
  • 17. (MD5 hash: 'Hello' asByteArray) asHexString (MD5 hash: # [1 2 3 4 5] from: 2 to: 4) asHexString input := # [1 2 3 4 5 6 7 8 9] readStream. (MD5 hashNext: 3 from: input) asHexString (MD5 hashFrom: input) asHexString
  • 18. SHS - NIST FIPS PUB 180 digest: 160 bits (20B) block: 512 bits (64B) padding: M | 10...0 | length (64bits) FIPS 180-1: SHA-1 (1995) FIPS 180-2: SHA-256, 384, 512 (2002) SHA-1 broken in 2005!
  • 19. input := 'Hello World!' asByteArray readStream. sha := SHA new. sha updateWithNext: 5 from: input. sha digest asHexString. sha updateFrom: input. sha digest asHexString. input reset. (SHA256 hashFrom: input) asHexString.
  • 20. authentic, non-reusable, unalterable signing uses the private key message, key => signature verification uses the public key message, key, signature => true/false
  • 21. signing: hash the plaintext encode digest encrypt digest with private key verifying: decrypt digest with public key decode digest hash the plaintext compare the digests
  • 22. alice := RSA new privateKey: keys privateKey. msg := 'Hello World' asByteArray. sig := alice sign: msg. sig asHexString bob := RSA new publicKey: keys publicKey. bob verify: sig of: msg
  • 23. NIST FIPS PUB 186 p prime (modulus): (512 + k* 64 <= 1024) q prime factor of p 1 (160 bits) g > 1; g^ q mod p = 1 (g has order q mod p) x < q (private key) y = g^ x mod p (public key) FIPS 186-1 (1998): RSA(X9.31) FIPS 186-2 (2001): ECDSA(X9.62) FIPS 186-3 (?2006): bigger keys up to 15K bits
  • 24. keys := DSAKeyGenerator keySize: 512. alice := DSA new privateKey: keys privateKey. sig := alice sign: 'Hello World' asByteArray bob := DSA new publicKey: keys publicKey. bob verify: sig of: 'Hello World' asByteArray
  • 25. [1] Anderson: Security Engineering [2] Ferguson, Schneier: Practical Cryptography [3] Kahn: The Codebreakers [4] Menezes, van Oorschot, Vanstone: Handbook of Applied Cryptography [5] Schneier: Applied Cryptography