Sunday, December 17, 2006

xmldap as a plugin to perpetual motion

Kevin Miller's new Firefox plugin wraps the native Windows CardSpace identity selector, and in the process provides a great card parsing implementation. Since Kevin was kind enough to implement a plugin framework, I figured I'd take advantage and added plugin support to the xmldap selector.

If you pick up the latest version of the plugin (requires Java 1.5 on your system) you will now find a new Identity Selector option in your preferences. If you have both Kevin and my extension installed, and you're on Windows, you can now flip back and forth between the CardSpace selector, and the xmldap selector at will.

The great news is that people implementing selectors will no longer need to worry about augmenting the browser. Now hopefully we can all quickly agree on a preferences structure to allow any implementation to easily add itself to the list.

If you're interested in writing you're own plugin, it's pretty's the basics of an XPCOM component that implements the plugin interface:

have fun!

Tuesday, December 12, 2006

Another Firefox Cardspace Extension

Check out this cool extension for Firefox by Kevin Miller

It basically wraps the native CardSpace implementation on Windows so you can use it from Firefox. Very robust looking parsing card detection, and the ability to implement an XPCOM interface to plugin other selectors:

IIdentitySelector..GetBrowserToken(issuer , recipientURL, requiredClaims ,data.optionalClaims , tokenType, privacyPolicy, privacyPolicyVersion , serverCert );

The selector implementation can be determined by the user's preferences, so it should be very simple to adapt the xmldap selector or other cross platform implementations to this model and let user's choose their selector.

Nice work Kevin!

Wednesday, December 06, 2006

Combining CardSpace and OpenID

At IIW I demo'd a little proof-of-concept showing the ability to login to a CardSpace relying-party, using an OpenID based identity. For those who didn't get a chance to see it, I provided a little screen cast here:

How-To Decrypt a CardSpace backup file

Having posted a utility that decrypts CardSpace backup files, I thought I'd take a moment to explain how it works. The backup file format is rather obscure, so hopefully this should help serve as a guide to people looking to import and export cards with non-Windows selectors.

The first thing to do is take a look at the CardSpace backup file format (edited for brevity):

<?xml version="1.0" encoding="utf-8"?>
<EncryptedStore xmlns="">
<EncryptedData xmlns="">
<CipherValue>...Base64 Encoded Ciphertext...</CipherValue>

Here we have the file format. There are really just two things we care about...the Salt, and the CipherValue. The first thing to do is extract these 2 values.

At this point, it's probably good to get an overview of what you'll be doing. The ciphertext is actually a 16 byte Initialization Vector, 32 bytes of signature data for validating integrity, and then a CardSpace RoamingStore xml document encrypted using a PBE. Specifically, it's a PKCS5v1 derived key and AES with CBC.

As you get started, one thing to be aware of is the byte order mark. Regardless of what it claims, this xml in this file is actually encoded using UTF-16LE.'s prefixed with 3 bytes of data. Here's what you should expect for the byte order mark:

byte[] bom = {(byte)0xEF, (byte)0xBB, (byte)0xBF};

You'll also want to know about a couple pieces of static entropy used in the algorithm:

byte[] encKeyEntropy = { (byte)0xd9, (byte)0x59, (byte)0x7b, (byte)0x26, (byte)0x1e, (byte)0xd8, (byte)0xb3, (byte)0x44, (byte)0x93, (byte)0x23, (byte)0xb3, (byte)0x96, (byte)0x85, (byte)0xde, (byte)0x95, (byte)0xfc };

byte[] integrityKeyEntropy = {(byte)0xc4, (byte)0x01, (byte)0x7b, (byte)0xf1, (byte)0x6b, (byte)0xad, (byte)0x2f, (byte)0x42, (byte)0xaf, (byte)0xf4, (byte)0x97, (byte)0x7d, (byte)0x4, (byte)0x68, (byte)0x3, (byte)0xdb};

So - back to business. Once you've extracted the salt and the ciphertext, you can begin to decrypt the backup file. Here are the steps you'll want to take:

  1. Remove the Byte Order Mark, and parse the XML file, extracting the Salt, and the CipherText
  2. Base64 decode the salt, and set it aside
  3. Base64 decode the ciphertext
  4. Copy the first 16 bytes of the ciphertext, and set it aside as your IV
  5. Copy the next 32 bytes of the ciphertext, and set it aside as your integrity check
  6. Concatenate the remaining bytes together with the IV. ( IV + remaining bytes ) Set this aside as your data
  7. Derive your keys using PKCS5v1. Take the bytes of the user's password used to encrypt the data, and concatenate it with the salt bytes. Take a SHA256 hash of those bytes, and then SHA256 hash the output another 999 times.
  8. Generate the encryption key by concatenating the static encryption entropy together with the derived key. Generate a SHA256 byte hash of these bytes, and that is your encryption key
  9. Generate the integrity key by concatenating the static entrgrity entropy together with the derived key. Generate a SHA256 byte hash of these bytes, and that is your integrity key
  10. Decrypt the data using AES/CBC/OAEP with the encryption key you generated
  11. Remove the byte order mark, and you have the decrypted RoamingStore.

So - that's the basics of decryption. If you'd like to encrypt a store, you simply perform that process in reverse.

Next, you'll want to validate the integrity of the data. Here's how:
  1. Concatenate the IV, the integrity check data ( bytes 12-48 that you set aside earlier), and the last block of data (the last 16 bytes)
  2. Sha 256 hash this, and you have the computed integrity check. Compare your computed value to the integrity check...if they match byte for byte, you're in luck.
That's it. Be wary of character encoding, but if you follow these steps, you should be able to encrypt/decrypt backup files

Friday, November 24, 2006

CardSpace Backup viewer

Ever wonder what's inside a CardSpace backup file? Now that the codebase can decrypt the backup files, I thought I'd add a quick tool that allows you to peek inside. Here's a little web app which will decrypt your backup file and return the xml inside:

And here's a screencast of how it works:

Tuesday, November 21, 2006

Minor Bug Fixes

I updated the Firefox Selector to fix a few minor bugs introduced in the Managed Cards support update.

Thanks to Axel and to Antoine Galland from Gemalto for trying it out and reporting the bugs.

Sunday, November 19, 2006

Managed Card Support for Firefox

One more important update for the Firefox selector - With this new release, I've added a simple proof-of-concept around Managed Cards.

The Firefox selector now supports importing managed cards, and retrieving tokens from an STS. It only has support for Username/Password authentication over the simple TransportBinding (this means transport security rather than message level security) Also, I've only tested against the may work against other implementations, but I haven't yet focused on interop.

That being said, this now demonstrates a complete end-to-end exchange without any Microsoft components. An opensource STS issuing a token to an opensource Relying Party, via an opensource selector...all on a Mac.

Here's a screencast of how it works:

As always, the selector and source are available at

Saturday, November 18, 2006

Firefox Plugin Updated

Thanks to the hard work of Axel Nennker and his friends, I've posted an update to the Firefox Selector. The selector now has these great features:

1) Support for Firefox 2.0 - the plugin should now work on 1.5+ and 2.0

2) Internationalization Support - Axel added i18n, and has localized to:

  • English
  • German
  • French
  • Norwegian
  • Swedish
  • Turkish
  • Czech
  • Arabic
  • and Chinese

3) There's also initial support for Logotype certificates, so that a website's icon embedded in a certificate can be displayed to the user as part of the verification process

You can download the latest plugin at

Thanks Axel!

Monday, November 06, 2006

STS is finally working

I finally checked in a working copy of the xmldap Security Token Service. It's a simple STS, which only supports the Transport Binding of CardSpace, but it's enough to see managed cards in action.

If you'd like to try it out, go to There you'll find a link to where you can create managed cards. You'll then be able to install them into CardSpace and use them to login to the Relying Party. Below is a screencast which demos the basic steps you should follow:

As always, it's open source. The code is pretty messy at the moment, but if you're curious you can take a look at Special thanks to the other contributors, and the folks at Arcot who figured out one of the missing pieces.

Tuesday, September 19, 2006

back online

Thanks to Ian, Ebe, and a new router, is back online.

Kim - you owe us $65.00 :-)

identityblog effect

Looks like Kim's two new posts have melted my server. He's the slashdot of the Identity world.

Sorry - the crack sys-admin team has been deployed. Hopefully we're back up soon!

Sunday, September 17, 2006

The Missing Infocard Schema

The Infocard Schema has been notoriously missing since Microsoft published RC1.

Here's the schema for the namespace

Playing with Managed Cards

I've just checked in code that can create Managed Cards that import into CardSpace RC1.

To allow people to play around, I've also added a quick little web app, which creates cards for you. You can try this out at:

If you'd like to try it out, you can either download the source from

Relying Party updated to support RC1

I finally got around to updating the Relying Party to support Cardspace RC1.


Saturday, September 16, 2006

Instructions for the CardSpace FirefFox Extention

It sounds like Craig Burton has been having trouble with the demo Cardspace Selector I put together for Firefox. I'm not sure what trouble he's been having, but I thought I'd toss up some quick instructions, and a screen cast.

Step 1) Make sure you're on Firefox 1.5 or greater.

Step 2) Make sure you've got J2SE 1.4x installed on your machine. The xmldap selector doesn't use any .net or Microsoft code...its a cross platform implementation written from scratch in Java. You can hit if you need to download a JDK

Step 3) Go to and download the Firefox extension. You may need to allow the popup blocker to trust my site. Restart firefox.

Step 4) Go to a Cardspace enabled site like xmldap, identityblog, or ping

Step 5) Click to login, create a card, and submit.

Note that you'll still get a warning saying: "Additional plugins are required to display all the media on this page" Ignore it...I haven't figured out how to make it go away yet. Please email me or comment if you know!

Craig and others - email me at cmort at if you have questions or issues!

Tuesday, September 12, 2006

Identity Selector for Safari

My good friend Ian Brown has taken the code and created an Identity Selector for Safari. It even integrates with the Apple Address Book for self-asserted cards. If you've got a Mac, check it out...if not, he's got a screen-cast.

Nice work Ian!

Sunday, August 27, 2006

6 screws and a plate!

6 screws and a plate!
Originally uploaded by Phil Hunt.
Phil Hunt from Oracle(OctetString), Ian Brown of SOA (BlueTitan) Phillip Kamps (yet another ex-sxipster), myself, and Phil's wife Wendy rode thigh deep powder at Whistler this year.

In a mad dash to the bottom to meet up with Mara, this happened to Wendy's knee.

She literally just laughed it off.

Update - My memory is off - it was Phillip instead of Ian. As Ian comments we was out with his own knee injury...which was my fault. Sorry Ian.

Catalyst 2006

mortimore, huang, shewchuk

Saturday, August 26, 2006 back online

Thanks to my friends at SOA Software, is back online.

There are a few new things as well:

  • The homepage has a new look, as well as a bunch of handy links:
  • The Relying Party has been updated to work with the latest CardSpace release.
  • The FireFox Identity Selector has been updated to get it working with the latest versions of Kim's blog and Ashish/Ping's demo site.
  • The selector also has a number of updates from Axel Nennker to support images for cards, and required fields in cards. Thanks Axel!
  • Axel also just came through with support for optionalClaims. Thanks again!

Thursday, June 15, 2006

Burnin' Down the House

"Chuck...this is Mark...apparently the house is on fire"

Everyone is ok, and the damage is minimal.

Slide show here

Identity Vocabulary Comparison

Here's a nice new overview of schemas across various identity systems by Johannes

Get it here

Discuss it here

Wednesday, June 07, 2006

Microsoft Labs STS

This was briefly available a few weeks ago...looks like it's live again:

Haven't tried it yet myself, but it looks interesting.

Thursday, May 11, 2006

Even better than the dolphins

This article about dolphins referring to each other by name has been making the rounds in the identity world.

The monkeys are still more human.

I completely agree...

...with Johannes' latest post.

It's too bad rdf is so difficult for people to work with (or even grok)...the simple injection of a predicate into the name/value pair and you'd retain the ability to serialize complex object graphs.

Monday, May 01, 2006

Firefox Identity Selector

I've just posted a prototype identity selector for firefox, which allows you to login to infocard enabled sites, without infocard, or even windows.

You can download it here:

In order to get started, download and install the extension, and then browse over to one of the public relying parties. It also requires that you have a JVM installed, which you can pick up from if need be.

Please note that this is of alpha quality. It only supports Self Asserted tokens, and many other desireable features have not been implemented. However, it should provide the based for some interesting discussions at IIW this week.

Enjoy, and please send feedback.

[Update: There seems to be a small bug with selecting cards. If you click on a card to select it, and its values do not fill in on the right side of the screen, then click it again until they do. If you attempt to submit with blank values it won't work]

[Update: Also - keep in mind that I haven't figured out how to make the Firefox warning that a plugin to handle the infocard object isn't installed. Simply ignore this, and please send me a note if you know how to make this go away]

Wednesday, April 19, 2006

Mara's on Flickr

Check out our pics from NYC

Or subscribe to her ATOM feed

Interesting code block...

Here's an interesting block of code for displaying Certificates I found while poking around Firefox this evening...

mapIssuerOrganization: function(name) {

if (!name) return null;

if (name == "RSA Data Security, Inc.")
return "Verisign, Inc.";

// No mapping required
return name;

Monday, April 10, 2006

Sunday, April 09, 2006

Finally...a Windows VM for the Mac

I've got to say, Parallel's workstation rocks. I'ts jsut like VMWare except it runs on OSX. Despite the occasional kernel panic (it's still in beta), I can now play with InfoCard without leaving my Mac. XP is super fast, and my friends at Sun will be glad to know that Solaris x86 is supported.

Here's some screen shots of InfoCard running in a VM (click for bigger shots):

Here, I'm prompting for an InfoCard

InfoCard displays some information about my RP, and asks if I want to send a card.

Since this is my first time using InfoCard, it asks if I'd like to create a card, or perhaps import some existing cards.

Here, I'm creating a new self-asserted card.

InfoCard confirms that I want to send my new card.

And I'm logged into my RP.

Friday, March 31, 2006

How to consume tokens from Infocard

So - if you’ve been wondering how my RP’s an overview. I’m not going to cover declaring Policy or anything, as Mike Jones’ paper seems to have covered it in pretty good detail. I’m assuming here you can get InfoCard to invoke and POST a token.

To get started, you need to get your hands on the XML Token. This should be pretty simple, as your web framework will generally hand back parameters already URL decoded.

Once you’ve got the token, you’ll need to decrypt the token. The token is transmitted as encrypted XML, and will look something like this:

<enc:EncryptedData xmlns:enc=""
<enc:EncryptionMethod Algorithm="" />
<dsig:KeyInfo xmlns:dsig="">
<enc:EncryptionMethod Algorithm="">
<dsig:DigestMethod Algorithm="" />
<wsse:SecurityTokenReference xmlns:wsse="">
<wsse:KeyIdentifier ValueType="" EncodingType="">zHXxYr8jTDe/UhznC81ixsQXSpI=</wsse:KeyIdentifier>

Basically what you have here is an ephemeral symmetric encryption key, which has itself been encrypted with the Public Key of the SSL Cert for the website InfoCard is interacting with. As you can see from the metadata provided in the KeyInfo fragment, the key is encrypted using RSA with OAEP encoding and SHA1, using the certificate identified in the SecurityTokenReference with the provided fingerprint (the fingerprint is a SHA1 hash of the cert bytes)

Your first job is to decrypt that encryption key. Step one - remove the Base64 encoding. Step 2 - you need to write a function which takes the private key for the cert referenced by the fingerprint, along with the data as input, and decrypts in this manner RSA-OAEP

Once you’ve successfully decrypted the key ( it should be 256 bits), you can use it to decrypt the token. As you can see in the XML, you need to use AES with a ChainedBlockCipher. Decrypt the token (Don’t forget to strip the initialization vectors...thanks Gary ), and you should see something similar to the following:

<saml:Assertion MajorVersion="1" MinorVersion="1"
IssueInstant="2006-03-29T20:52:45.312Z" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion">
<saml:Conditions NotBefore="2006-03-29T20:52:45.312Z" NotOnOrAfter="2006-03-29T21:52:45.312Z" />
<KeyInfo xmlns="">
<e:EncryptedKey xmlns:e="">
<e:EncryptionMethod Algorithm="">
<DigestMethod Algorithm="" />
<o:SecurityTokenReference xmlns:o="">
<o:KeyIdentifier ValueType="" EncodingType="">BCDy8bwQIxTqcoTObIhcvR2KOLw=</o:KeyIdentifier>
<saml:Attribute AttributeName="GivenName" AttributeNamespace="">
<saml:Attribute AttributeName="Surname" AttributeNamespace="">
<saml:Attribute AttributeName="EmailAddress" AttributeNamespace="">
<Signature xmlns="">
<CanonicalizationMethod Algorithm="" />
<SignatureMethod Algorithm="" />
<Reference URI="#uuid:d2de97e7-96ac-4bb3-a373-4fc11c914519">
<Transform Algorithm="" />
<Transform Algorithm="" />
</Transforms><DigestMethod Algorithm="" />

The next step would be to quickly check the validity period on this Assertion to make sure it’s still fresh. You might also want to check the AssertionID against a table of previously seen assertions to prevent replay...depends on your level of paranoia.

On to signature should follow the steps outlined in XML-DSIG, but to paraphrase, check the digest of the canonicalized assetion against the digest in the SignedInfo block, and then val the signature of the canonicalized SignedInfo using a PublicKey constructed from the provided KeyInfo.

Now, what’s bugging me is the use for the Symmetric Proof key provided in the Subject of the Assertion. Super Pat and I discussed this for awhile, and since it’s not used immediately in this protocol exchange, our best guess is that it’s used in subsequent interactions with the service, although I must admit the InfoCard docs are a little fuzzy on this subject. If anyone can fill me in, I’d appreciate it!

Finally, if your signature validation worked, extract the claims, enforce any policy you’d like, create a session, set a cookie, etc...

good luck!

Thursday, March 30, 2006

Make your own security tokens without InfoCard

Once you can consume security tokens from InfoCards, it's not too difficult to make them. Since most people don't have the time to try out InfoCard for real, I thought I'd add a quick utility to make your own tokens, and submit them to my RP. This should allow you to at least learn about the format and protocol for using InfoCard over the web.

Try the updated Java RP

Wednesday, March 29, 2006

Simple Java Based Relying Party

I've just turned on an InfoCard Relying Party, implemented from the ground up in Java. If you've got InfoCard up and running, please login and send me a comment.

Java Based RP

I'll follow up soon with details, as well as an overview of how it works.

[Update: I've had some complaints that this isn't working with the latest and greatest IE ( due to an issue with IE according to Kim ) I suggest build 7.0.5296.0 for now. ]