Rijndael in ASP.NET and Delphi

J

Jon Skeet [C# MVP]

Who can help? I'm trying to implement an encrypted (plain text)
communication between a Delphi application and an ASP.NET. My choice
is AES/rijndael-128. For both sides, i use standard modules:

Delphi: TDCP_rijndael Component (DCPcrypt Cryptographic Component
Library v2) from cityinthesky (www.cityinthesky.com)

ASP.NET : Standard library of Rijndael

both sides are working, BUT they do different! The results in encryption
and decryption do not match when i use same keys. now i've no clue what
i am doing wrong.

Anyone out there who can give me the right hint??

The first thing to do is find a third implementation - that way you
can easily find out which of your current implementations is broken.

Then it would help if you could post the C# code. It's easy to mess up
using encryption.

Jon
 
D

Doug Forster

Hi Iwan,

I don't know the answer to your question, but have you considered doing the
Delphi side via a COM exposed C# dll. We have just starting doing this to
gain access to the .NET database libraries from Delphi and it is proving
very successful.

Cheers
Doug Forster
 
A

Arne Vajhøj

Iwan said:
Who can help? I'm trying to implement an encrypted (plain text)
communication between a Delphi application and an ASP.NET. My choice
is AES/rijndael-128. For both sides, i use standard modules:

Delphi: TDCP_rijndael Component (DCPcrypt Cryptographic Component
Library v2) from cityinthesky (www.cityinthesky.com)

ASP.NET : Standard library of Rijndael

both sides are working, BUT they do different! The results in encryption
and decryption do not match when i use same keys. now i've no clue what
i am doing wrong.

Anyone out there who can give me the right hint??

Same key size ? Same key ? Same iv ? Same sequences of update
and final calls ?

Arne
 
A

Arne Vajhøj

Iwan said:
Who can help? I'm trying to implement an encrypted (plain text)
communication between a Delphi application and an ASP.NET. My choice
is AES/rijndael-128. For both sides, i use standard modules:

Delphi: TDCP_rijndael Component (DCPcrypt Cryptographic Component
Library v2) from cityinthesky (www.cityinthesky.com)

ASP.NET : Standard library of Rijndael

both sides are working, BUT they do different! The results in encryption
and decryption do not match when i use same keys. now i've no clue what
i am doing wrong.

Anyone out there who can give me the right hint??

If you post encryption of "This is a test" from both in hex or base64,
then we could compare.

Arne
 
I

Iwan Budihalim

Who can help? I'm trying to implement an encrypted (plain text)
communication between a Delphi application and an ASP.NET. My choice
is AES/rijndael-128. For both sides, i use standard modules:

Delphi: TDCP_rijndael Component (DCPcrypt Cryptographic Component
Library v2) from cityinthesky (www.cityinthesky.com)

ASP.NET : Standard library of Rijndael

both sides are working, BUT they do different! The results in encryption
and decryption do not match when i use same keys. now i've no clue what
i am doing wrong.

Anyone out there who can give me the right hint??
 
R

rossum

Who can help? I'm trying to implement an encrypted (plain text)
communication between a Delphi application and an ASP.NET. My choice
is AES/rijndael-128. For both sides, i use standard modules:

Delphi: TDCP_rijndael Component (DCPcrypt Cryptographic Component
Library v2) from cityinthesky (www.cityinthesky.com)

ASP.NET : Standard library of Rijndael

both sides are working, BUT they do different! The results in encryption
and decryption do not match when i use same keys. now i've no clue what
i am doing wrong.

Anyone out there who can give me the right hint??
Just a thought, have you tried the official test vectors in FIPS 197:
http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf

You can play with both your implementations until you get the right
results from both of them.

For AES-128 (10 rounds) the official test vectors are:

PLAINTEXT: 00112233445566778899aabbccddeeff
KEY: 000102030405060708090a0b0c0d0e0f
CYPHERTEXT: 69c4e0d86a7b0430d8cdb78070b4c55a

rossum
 
A

Arne Vajhøj

Iwan said:
I think, i better share the library so they can read between C# and Delphi.

AES is rather well define and it should be possible to find the problem.

And I would avoid using COM in ASP.NET if possible.

Arne
 
D

Doug Forster

And I would avoid using COM in ASP.NET if possible.

Who said anything about using COM in ASP.NET ? I suggested he could use COM
to expose the .NET encryption libraries from his Delphi app. I still think
thats a good strategy as he would then be using the same libraries at each
end instead of messing about trying to find whatever quirky difference might
be causing his problem.

Cheers
Doug Forster
 
A

Arne Vajhøj

Doug said:
Who said anything about using COM in ASP.NET ? I suggested he could use COM
to expose the .NET encryption libraries from his Delphi app.

Sorry - I have misread your post.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top