Title: XML Cryptography
1XML Cryptography
- Krishna Sattiraju
- CS 792 .NET
2Overview
- What is XML Encryption
- Methods for Encryption
- Storage of Encrypted Data
- Benefits of XML Secure Storage
- Types of XML Encryption
3XML Encryption
- Specification that defines how to encrypt data
- Used to encrypt data, keying information and
algorithms
4Methods for encryption
- Using Symmetric Encryption
- Combination of Symmetric and Asymmetric
Encryption - X.509 Certificates
5Storage of Encrypted Data
- Whole element is replaced with an element
named ltEncryptedDatagt - Only the data in the element is replaced and its
name remains readable in the document
6 XML Document Code
7Encrypted Code
8Asymmetric XML Encryption and Decryption
- Select XML Element
- Encrypt element
- Encrypt Session Key
- Create Encrypted Data element
- Replace Original element
- Select Encrypted Data element
- Decrypt Session Key
- Decrypt Cipher Data using unencrypted symmetric
- Replace the Encrypted Data Element
9Name Spaces
- System. XML
- System.Security. Cryptography
- System.Security.Cryptography.xml
10Benefits of XML Secure Storage
- XML Is Structured Format
- Allows for secure storage of documents
- Provides granularity
- Leverages Existing technologies
11XML Encryption
- Encrypted data is maintained.
- All information needed to decrypt a document is
contained within the document. - Session can be secured on the document level and
shared between multiple parties. - Sensitive data is easily interchanged between
applications.
12XML Encryption of Element
lt?xml version'1.0'?gt ltPaymentInfo
xmlns'http//example.org/paymentv2'gt ltNamegtJohn
Smith lt/Namegt ltEncryptedData Type'http//www.w3.
org/2001/04/xmlencElement' xmlns'http//www.w3.o
rg/2001/04/xmlenc'gt ltCipherDatagt
ltCipherValuegtA23B45C56 lt/CipherValuegt
lt/CipherDatagt lt/EncryptedDatagt lt/PaymentInfogt
13XML Encryption using Content
lt?xml version'1.0'?gt ltPaymentInfo
xmlns'http//example.org/paymentv2'gt ltNamegtJohn
Smith lt/Namegt ltCreditCard Limit'5,000'
Currency'USD'gt ltEncryptedData
xmlns'http//www.w3.org/2001/04/xmlenc'
Type'http//www.w3.org/2001/04/xmlencContent'gt
ltCipherDatagt ltCipherValuegtA23B45C56 lt/CipherValue
gt lt/CipherDatagt lt/EncryptedDatagt lt/CreditCardgt
lt/PaymentInfogt
14Encrypting XML Content (Character Data)
lt?xml version'1.0'?gt ltPaymentInfo
xmlns'http//example.org/paymentv2'gt ltNamegtJohn
Smithlt/Namegt ltCreditCard Limit'5,000'
Currency'USD'gt ltNumbergt ltEncryptedData
xmlns'http//www.w3.org/2001/04/xmlenc'
Type'http//www.w3.org/2001/04/xmlencContent'gt
ltCipherDatagt ltCipherValuegtA23B45C56lt/CipherValuegt
lt/CipherDatagt lt/EncryptedDatagt lt/Numbergt
ltIssuergtExample Banklt/Issuergt ltExpirationgt04/02lt/
Expirationgt lt/CreditCardgt lt/PaymentInfogt
15XML Encryption in WS-Security
ltenvEnvelope xmlnsenv"http//www.w3.org/2
001/12/soap-envelope"
xmlnsxenc"http//www.w3.org/2001/04/xmlenc"gt
ltenvHeadergt ltwsseSecurity
xmlnswsse"http//schemas.xmlsoap.org/ws/200
2/04/secext"gt ltxencReferenceListgt
ltxencDataReference URI"encryptedID"/gt
lt/xencReferenceListgt
lt/wsseSecuritygt lt/envHeadergt ltenvBodygt
ltxencEncryptedData Id"encryptedID"gt
ltxencCipherDatagt
ltxencCipherValuegt...lt/xencCipherValuegt
lt/xencCipherDatagt lt/xencEncryptedDatagt
lt/envBodygt lt/envEnvelopegt
16XML Encryption w/ Digital Certificate
ltEncryptedData xmlns"http//www.w3.org/2001/04/xm
lenc"
Type"http//www.w3.org/2001/04/xmlencElement"gt lt
EncryptionMethod Algorithm"http//www.
w3.org/2001/04/xmlenctripledes-cbc"/gt ltKeyInfo
xmlns"http//www.w3.org/2000/09/xmldsig"gt
ltEncryptedKey xmlns"http//www.w3.org/2001/04/xml
enc"gt ltEncryptionMethod Algorithm"http//www.
w3.org/2001/04/xmlencrsa-oaep-mgf1p"/gt
ltKeyInfo xmlns"http//www.w3.org/2000/09/xmldsig
"gt ltKeyNamegtrsakey.pemlt/KeyNamegt
lt/KeyInfogt ltCipherDatagt
ltCipherValuegtIPiEu9NvEsGyvV . . .lt/CipherValuegt
lt/CipherDatagt lt/EncryptedKeygt lt/KeyInfogt ltCiphe
rDatagtltCipherValuegtxrfPSABEI8 . .
.lt/CipherValuegt lt/CipherDatagtlt/EncryptedDatagt
17XML Signing AND XML Encryption
- Order of Cryptographic operations matters
- Signing and Encrypting
- Encrypting and Signing
- Change of the order while Decrypting - Danger
18References
- XML Encryption by By Derek Smyth
http//dotnetslackers.com/articles/xml/XMLEncrypti
on.aspx - XML Encryption Syntax and Processing By Takeshi
Imamura , Blair Dillaway, Ed Simon - http//www.ibm.com/developerworks/xml/library/x-en
crypt2/ - http//www.devx.com/dotnet/Article/21564
19 Thank You!!!