Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2005

Tip: Looking for answers? Try searching our database.

Generating encryption keys

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JamesWilson - 13 Dec 2005 09:25 GMT
Hi everyone,

I'm wanting to encrypt the soap body using the username token (i'm using WSE
2 SP3), and it has worked. However my colleague is using PHP and is wanting
to decrypt the soap message however we are not sure how the key and IV for
the aes encryption is created. Does anyone know how it generates the key and
IV for the encryption ? I have looked everywhere and can't seem to find
anything about it, or anyone who knows.

James
Eric Pearson - 14 Dec 2005 01:04 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.