openpgp message format

29
Java Privacy Guard An Implementation of the OpenPGP Message Format in Java Stefan More, Advisor: Dieter Bratko, Peter Lipp June 13, 2014

Upload: stefan

Post on 13-Jul-2015

226 views

Category:

Software


1 download

TRANSCRIPT

Page 1: OpenPGP Message Format

Java Privacy Guard

An Implementation of theOpenPGP Message Format in Java

Stefan More,Advisor: Dieter Bratko, Peter Lipp

June 13, 2014

Page 2: OpenPGP Message Format

Overview

1. Problem Statement

2. openPGP

3. Java Privacy Guard

4. Summary & Outlook

Stefan More, Bakk@IAIKJune 13, 20142

Page 3: OpenPGP Message Format
Page 4: OpenPGP Message Format
Page 5: OpenPGP Message Format
Page 6: OpenPGP Message Format

Problem Statement

Message Confidentiality

Message Integrity

Sender Authentication

Anonymity

End to End

Stefan More, Bakk@IAIKJune 13, 20144

Page 7: OpenPGP Message Format

openPGP

Stefan More, Bakk@IAIKJune 13, 20145

Page 8: OpenPGP Message Format

PGP History

Pretty Good Privacy

1991: PGP created by Phil Zimmermann

most widely used email encryption software [6]

1998: PGP 5 standardized: openPGP (RFC 4880)

2010: PGP assets sold to Symantecfor $ 300.000.000 (Enterprise Security)

Stefan More, Bakk@IAIKJune 13, 20146

Page 9: OpenPGP Message Format

Standard: openPGP (RFC 4880 etc.)

Implementations:

PGP (Zimmermann, Symantec)GnuPG / GPG (GNU)APG (Android)End-to-End (Google Chrome)Bouncycastle (Java)Java Privacy Guard (IAIK-JCE)

Stefan More, Bakk@IAIKJune 13, 20147

Page 10: OpenPGP Message Format

openPGP

Combines Symmetric-Key Cryptographyand Public-Key Cryptography

+ Hashing

+ Data Compression

+ Trust Model

Stefan More, Bakk@IAIKJune 13, 20148

Page 11: OpenPGP Message Format

Revisiting Problem Statement

Message Confidentiality: Encryption

Message Integrity: Digital Signatures

Sender Authentication: Web Of Trust

Anonymity? Tor, I2P, . . .

Stefan More, Bakk@IAIKJune 13, 20149

Page 12: OpenPGP Message Format

De-/Encryption

Encrypt Data with Random Symmetric-Key,encrypt Symmetric-Key with Public-Key

Multiple Receiver: Encrypt Data only once

Symmetric Cipher: AES, IDEA, 3DES, CAST5, . . .Keysize ≥ 112 bits [7]

Public-Key Cipher: RSA, ElGamalKeysize ≥ 2048 bits [7]

Stefan More, Bakk@IAIKJune 13, 201410

Page 13: OpenPGP Message Format

Stefan More, Bakk@IAIKJune 13, 201411

Page 14: OpenPGP Message Format

Stefan More, Bakk@IAIKJune 13, 201411

Page 15: OpenPGP Message Format

Stefan More, Bakk@IAIKJune 13, 201411

Page 16: OpenPGP Message Format

Stefan More, Bakk@IAIKJune 13, 201411

Page 17: OpenPGP Message Format

Digital Signatures

Hash Message Body & Sign Hash with Private Key

Sign Other Keys (→ Trust Model)

Hash Algorithms: SHA-2, SHA-1, RIPE-MD/160, MD5

Signature Algorithms: RSA, DSA

Stefan More, Bakk@IAIKJune 13, 201412

Page 18: OpenPGP Message Format

Web Of Trust

Decentralized Trust Model(Can be centralized)

No Certificate Authority

Transitive Trust

Pathfinder: pgp.cs.uu.nl/doc/faq.html

Key-Set Analysis: pgp.cs.uu.nl/plot

Stefan More, Bakk@IAIKJune 13, 201413

Page 19: OpenPGP Message Format

Java Privacy GuardopenPGP in Java using IAIK-JCE

Stefan More, Bakk@IAIKJune 13, 201414

Page 20: OpenPGP Message Format

Java Privacy Guard

Full Implementation of RFC 4880 (not yet)

Compatibility to other PGP Implementations

Simple API & Extended API

Key Management

Crypto provided by JCA (default: IAIK-JCE)

Stefan More, Bakk@IAIKJune 13, 201415

Page 21: OpenPGP Message Format

openPGP Structure

Packets:

Internal StructureContain actual Data (+ Metadata)

Transferable:

Consists PacketsMessage, Keys, Signature, Keyring, . . .

Stefan More, Bakk@IAIKJune 13, 201416

Page 22: OpenPGP Message Format

-----BEGIN PGP MESSAGE -----

Comment: GPGTools - http :// gpgtools.org

hQIOA5v3tWTQmvtJEAf/QPf5FuQMZpG+cKylmm819K2eoIv75nxTSk25tLwVkGMi

IR0xOVCkTV+PNgi7aSbhNxBZ6dMJougl1cGx/XtKZ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L5EByrY/LEXeCzPjok3JCt7wZhqjdcrDJLveYfw2StGunxhfl33wRqx

kBG0G49ba+v3fyOTSqjlA5yekZ6YkQJaQIfLCa1Guierw9oFKAENMx1xzfL4TJWW

RGx54xBUmMblZPVIDgE5cWVqmaZoRH5SvlEQEi9lW8yuGVvdJfdLHdPsRSxRPwz4

fDHfpYLYM9Kj5My3inYd9NmIvWoFTFgHJuy3B3pd4pPXLxjgA+Qo3ncCneQkluDe

ySG6c8b+hCyl9b4S/qBnzPumxCVZ1FUvubuAboMgGno0hd8=

=2IUj

-----END PGP MESSAGE -----

Stefan More, Bakk@IAIKJune 13, 201417

Page 23: OpenPGP Message Format

tag: Public-Key EncryptedSession Key Packetlength: 526version: 3keyId:“9BF7B564D09AFB49”publicKeyAlgorithm:“Elgamal (Encrypt-Only)”encryptedSessionKey

tag: Public-Key EncryptedSession Key Packetlength: 524version: 3keyId:“B5801FD826746039”publicKeyAlgorithm:“RSA (Encrypt or Sign)”encryptedSessionKey

tag: Symmetrically Encrypted Data Packetlength: 33Encrypted Data

Stefan More, Bakk@IAIKJune 13, 201418

Page 24: OpenPGP Message Format

Load & Decrypt PGP Message

IAIK . addAsProvider ( ) ;

PGPMessage pgpMessage = parseMessage ( i s1 ) ;PGPPrivateKey pr ivKey = parsePr ivatekey ( i s2 ) ;

PGPCipher c ipher = new PGPCipher ( ) ;c ipher . i n i t ( PGPCipher .DECRYPT MODE, p r i vkey ) ;

byte [ ] c l e a r t e x t = c ipher . doFina l ( pgpmessage ) ;

Stefan More, Bakk@IAIKJune 13, 201419

Page 25: OpenPGP Message Format

Summary

Studied RFC 4880 & IAIK-JCE

Implemented:

Reading ASCII-Armor (Base 64 + CRC24)Parsing PGP Message Objects (Packets)Key Management (Simple Keychain)Message Decryption (RSA & ElGamal)Signature Validation (RSA & DSA)Decompression

Stefan More, Bakk@IAIKJune 13, 201420

Page 26: OpenPGP Message Format

Outlook / Future Research

Message Encryption and Signature Validation

Missing parts of RFC 4880 (Partial body length, . . . )

RFC 6637: ECC

Keyservers?

Stefan More, Bakk@IAIKJune 13, 201421

Page 27: OpenPGP Message Format

Thank You for Your AttentionQuestions? Remarks?

Stefan More, Bakk@IAIKJune 13, 201422

Page 28: OpenPGP Message Format

[1] Laura Poitrashttps://commons.wikimedia.org/wiki/File:Edward_Snowden-2.jpg

[2] Glenn Greenwald https://en.wikipedia.org/wiki/File:Glenn_greenwald_portrait_transparent.png

[3] Katy Scogginhttps://commons.wikimedia.org/wiki/File:Laura_Poitras_2014.jpg

[4] Regionales RechenZentrum Erlangenhttps://commons.wikimedia.org/wiki/Category:RRZE-Icon-Set

[5] The Opte Project http://www.opte.org/the-internet

[6] http://www.philzimmermann.com/EN/background/index.html

[7] Recommendation for Key Management, Special Publication 800-57 Part 1Rev. 3, NIST, 07/2012. http://www.keylength.com/en/4/

[8] http://cirw.in/gpg-decoder

Stefan More, Bakk@IAIKJune 13, 201423

Page 29: OpenPGP Message Format

Oracle and Java are registered trademarks of Oracle and/or its affiliates.Google and Chrome are registered trademarks of Google and/or its affiliates.Other names may be trademarks of their respective owners.

Stefan More, Bakk@IAIKJune 13, 201424