Web Cryptography API

Transcrição

Web Cryptography API
Web Cryptography API
Philipp Oehme
Hauptseminar
Ablauf
Situation im Web
API
Codebeispiel
Demo
Quellen





2
Web Cryptography API
10.12.2012
Situation im Web (1)



3
Sicherheit
Authentizität
Vertraulichkeit
Web Cryptography API
10.12.2012
Situation im Web (2)
Verschlüsselung der Kommunikation zwischen Usern
(FB, Gchat)
Verschlüsselung/Signieren von lokalen Daten (FB)
WebMail Verschlüsselung
Cloud
Multifaktor-Authentifizierung
Nur verifizierten Code in Web Apps ausführen
Nutzen von JOSE







4
Web Cryptography API
10.12.2012
Situation im Web (3)
5
Web Cryptography API
10.12.2012
Situation im Web (4)
6
Web Cryptography API
10.12.2012
Situation im Web (5)
7
Web Cryptography API
10.12.2012
Situation im Web (6)
Was wollen wir also?

Unterstützung von Kryptografie in Browsern
Unabhängig von Gerät / System / Browser
Einfach zu nutzen

Web Javascript Kryptografie API


8
Web Cryptography API
10.12.2012
API (1)

Gibt es so was nicht schon?


Ja, aber:





9
SJCL, Crypto JS, jscrypto, …
Langsam im Vergleich zu nativen Lösungen
Code muss erst übertragen werden
DOM Problem (Objekte, Rebinding)
Kein sicherer RNG
Kein sicherer Keystore
Web Cryptography API
10.12.2012
API (2)
Web Crypto API Umfrage
10
Web Cryptography API
10.12.2012
API (3)

„The Web Cryptography Working Group will develop a
Recommendation-track document that defines an API
that lets developers implement secure application
protocols on the level of Web applications, including
message confidentiality and authentication services, by
exposing trusted cryptographic primitives from the browser.
This will promote higher security insofar as Web application
developers will no longer have to create their own or use
untrusted third-party libraries for cryptographic primitives. “
http://www.w3.org/2011/11/webcryptography-charter.html
11
Web Cryptography API
10.12.2012
API (4)
• asynchron
Funktionen
• Verschlüsselung
• Entschlüsselung
• Signaturen
• Hash/MD
• Schlüsselverwaltung
• Gebräuchlichsten
Kryptoalgorithmen
12
Web Cryptography API
10.12.2012
API (5)
interface CryptoOperation : EventTarget {
void init();
void processData(ArrayBufferView buffer);
void complete();
void abort();
readonly attribute Key key;
readonly attribute Algorithm algorithm;
readonly attribute any result;
[TreatNonCallableasNull] attribute Function onabort;
[TreatNonCallableAsNull] attribute Function onerror;
[TreatNonCallableAsNull] attribute Function oninit;
[TreatNonCallableAsNull] attribute Function onprogress;
[TreatNonCallableAsNull] attribute Function oncomplete;
};
13
Web Cryptography API
10.12.2012
API (6)

Crypto interface






CryptoOperation createEncrypter(algorithmid, key);
CryptoOperation createDecrypter(algorithmid, key);
CryptoOperation createSigner(algorithmid, key);
CryptoOperation createVerifier(algorithmid, key, signature);
CryptoOperation createDigester(algorithmid);
Key
Key immer Domains zugeordnet
 key ist KeyID des Schlüsselpaares
 Zugriff auf Privatekey nur von bestimmten Funktionen
z.B:

var encryptionKey = window.crypto.keys.getPubKeyById("78966b83-b0038");
window.crypto.keys.removeKeyById(encryptionKey.id);
14
Web Cryptography API
10.12.2012
Codebeispiel
Erzeugen eines Schlüssels und signieren von Daten

var publicExponent
algorithmSign = ={ new Uint8Array([0x01, 0x00, 0x01]);
name: “RSASSA-PKCS1-v1_5“,
//Algorithm
Object
// RsaSsaParams
var algorithmKeyGen
={
params: {
name: “RSASSA-PKCS1-v1_5“,
hash: {
// RsaKeyGenParams
name: “SHA-256“
params: {
}
modulusLength: 2048,
}
publicExponent: publicExponent
};
}
};
15
Web Cryptography API
10.12.2012
Codebeispiel
var keyGen = window.crypto.createKeyGenerator(algorithmKeyGen
true, // temporary
false, // extractable
[“sign“]);
keyGen.oncomplete = function onKeyGenComplete(event)
{
var signer = window.crypto.createSigner(algorithmSign, event.target.result.privateKey.id);
signer.oncomplete = function signer_oncomplete(event){…};
signer.onerror = function signer_onerror(event){…};
signer.oninit = function signer_oninit(event){
signer.processData(myData);
};
signer.onprogress = function signer_onprogress(event){
signer.complete();
};
signer.init();
}
16
Web Cryptography API
10.12.2012
Nulltxt



Versuch das DOM-Problem zu lösen
„bridge-API“
Erzeugt DOMRequest Objekt
var request = window.navigator.bridge.getCipherObject({
type: "keygen",format: "DER_BASE64"});
request.onsuccess = function (){ */ this.result.publicKey is our key /* };
request.onerror = function (error){};
{ // um Daten zu verschlüsseln muss so etwas verwendet werden
type: "write",
format: "DER_BASE64",
recipientName: "drzhivago",
publicKey: A_PUBLIC_KEY,
keyID: 7635263572
}
17
Web Cryptography API
10.12.2012
Demo
Präsentation DOMCrypt API und Nulltxt
18
Web Cryptography API
10.12.2012
Ausblick

Was gibt es noch zu tun?







Schlüssel übertragen?!
Schlüsselverwaltung
Bisher nur der 1. Entwurf erschienen
Februar 2013 Last Call
August 2012 Candidate Recommendations
November 2013 Proposed Recommendations
März 2013 Recommendations
19
Web Cryptography API
10.12.2012
Quellen








http://www.w3.org/2011/11/webcryptography-charter.html
http://www.w3.org/2012/webcrypto/WebCryptoAPI
http://wiki.mozilla.org/Privacy/Features/DOMCryptAPI
http://monocleglobe.wordpress.com
http://nulltxt.se/nulltxt/
http://messages.domcrypt.org/
http://news.ycombinator.com/item?id=4549504
Web Crypto API minutes
20
Web Cryptography API
10.12.2012
Vielen Dank für die Aufmerksamkeit
Noch Fragen?
21
Web Cryptography API
10.12.2012