Here's how I create the algorithm in my security token.
I first get a regular Symmetric algorithm
//algorithmName is a string representing the..uh...algorithm ("Rijndael"
for aes)
SymmetricAlgorithm alg = SymmetricAlgorithm.Create(algorithmName);
alg.KeySize = key.Length * 8;
alg.Key = key;
alg.IV = iv;
if you are GENERATING the key/iv, call GenerateKey(), GenerateIV() on the
SymmetricAlgorithm
Then on your Custom token class (mine supports AES128/192/256 and 3des, depending
on client/server negotiation)
public override KeyAlgorithm Key
{
get
{
if (m_KeyAlgorithm != null) return m_KeyAlgorithm;
if (this.m_SymmetricAlgorithm is Rijndael)
{
switch(this.m_SymmetricAlgorithm.KeySize)
{
case 128:
this.m_KeyAlgorithm = new AES128((Rijndael)this.m_SymmetricAlgorithm);
break;
case 192:
this.m_KeyAlgorithm = new AES192((Rijndael)this.m_SymmetricAlgorithm);
break;
case 256:
this.m_KeyAlgorithm = new AES256((Rijndael)m_SymmetricAlgorithm);
break;
default:
throw(new InvalidOperationException("" + this.m_SymmetricAlgorithm.KeySize
+ " is not a valid key length"));
break;
}
}
else if (this.m_SymmetricAlgorithm is System.Security.Cryptography.TripleDES)
{
this.m_KeyAlgorithm = new Microsoft.Web.Services2.Security.Cryptography.TripleDES(this.m_SymmetricAlgorithm);
}
return this.m_KeyAlgorithm;
}
}
> Hi everyone,
>
[quoted text clipped - 7 lines]
>
> James
JamesWilson - 14 Dec 2005 08:23 GMT
Hi Eric,
sorry I don't think I was clear enough. I am not wanting to know how to do
it in .net, but merely the algorithim it uses. E.g. does it use P_SHA1 to
create the key, or does it use some other kind of hashing?
What I have heard is that it uses P_SHA1 to create the key, by P_SHA1(shared
secret, label+nonce+created) where + is concatentation.
James
> Here's how I create the algorithm in my security token.
>
[quoted text clipped - 58 lines]
> >
> > James