Fix type-cast error with typescript 1.0

Sideways casting between unrelated types fails with tsc 1.0 so
we cast up to `any` and then back down to CryptoExtras
as described at http://typescript.codeplex.com/workitem/1236