473,597 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rijndael in ASP.NET and Delphi

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??
Nov 28 '07 #1
10 7801
On Nov 29, 6:57 am, "Iwan Budihalim" <iwan_budiha... @visuallabs.net >
wrote:
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
Nov 28 '07 #2
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

"Iwan Budihalim" <iw************ @visuallabs.net wrote in message
news:eb******** ******@TK2MSFTN GP06.phx.gbl...
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??

Nov 28 '07 #3
On Wed, 28 Nov 2007 08:03:24 -0800 (PST), "Jon Skeet [C# MVP]"
<sk***@pobox.co mwrote:
>The first thing to do is find a third implementation - that way you
can easily find out which of your current implementations is broken.
Try Bouncy Castle: http://www.bouncycastle.org/csharp/

I use their Java crypto library and it works very well.

rossum

Nov 28 '07 #4
Iwan Budihalim wrote:
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
Nov 29 '07 #5
Iwan Budihalim wrote:
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
Nov 29 '07 #6
I think, i better share the library so they can read between C# and Delphi.
"Doug Forster" <nobody@nowhere ,comwrote in message
news:Oo******** ******@TK2MSFTN GP03.phx.gbl...
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

"Iwan Budihalim" <iw************ @visuallabs.net wrote in message
news:eb******** ******@TK2MSFTN GP06.phx.gbl...
>Who can help? I'm trying to implement an encrypted (plain text)
communicatio n 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??


Nov 29 '07 #7
On Wed, 28 Nov 2007 22:57:26 -0800, "Iwan Budihalim"
<iw************ @visuallabs.net wrote:
>Who can help? I'm trying to implement an encrypted (plain text)
communicatio n 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/publication...7/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: 001122334455667 78899aabbccddee ff
KEY: 000102030405060 708090a0b0c0d0e 0f
CYPHERTEXT: 69c4e0d86a7b043 0d8cdb78070b4c5 5a

rossum

Nov 29 '07 #8
Iwan Budihalim wrote:
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
Dec 3 '07 #9
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
Dec 3 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2409
by: Ignacio De Marco | last post by:
I'm not very familiar with C, so I would like to ask you how can use the algorithm Rijndael, suppousing that I want two simple functions (in C ANSI) implementing the CBC or ECB Modes (is the same for me, because I have both implementations in Delphi, but i need the same implementations in C for an AS400) with an interface similiar to this (in Object Pascal): function Encrypt(PlainText: string; Key: string): string function...
3
2615
by: Amy L. | last post by:
I have a client / server application. I just want to encrypt small amounts of data 1<x<1024 characters or so. I need to load the same Key and IV in both applications. However, both the key and IV are byte arrays. What is the best way to get the keys loaded in both applications? For example in RSA you can export the keys to XML. Can you do this in Rijndael? I tried using System.Text.Encoding.UTF8 or ASCII, but this does not appear...
5
6913
by: William Stacey [MVP] | last post by:
The Decypt2() method below does not work. It completes, but does not do the right thing. The first transform request returns 0 bytes. The first Decypt() method works as we work on a stream instead of blocks. I would like to know how to get the block method working. TIA. using System; using System.IO; using System.Security.Cryptography; namespace SocketServers.Crypto
4
5528
by: Mantorok | last post by:
Hi I have a couple of encryption methods but when I call decrypt I get the string back but with a load \0 escape characters on the end? Any idea why? It is actually causing problems in some places, here are my methods: public static string Encrypt(string input, byte key, byte iv)
5
4171
by: ~~~ .NET Ed ~~~ | last post by:
Anybody has any idea why this simple thing is not working? I pass a text file as input to encrypt it, then pass the encrypted version to the same function and get some garbled data not at all resembling the input file. Rijndael rijndaelAlg = Rijndael.Create(); rijndaelAlg.BlockSize = 128; // 128 bits to comply with AES rijndaelAlg.Padding = PaddingMode.PKCS7;
0
2086
by: Jens Müller | last post by:
Hello, I try to program a Rijndael encryption in Windows which has to be compatible with php. In php I use the code below to encrypt with a 256 Bit Key and a 256 Bit block cipher. My windows code has the same specs, but the outcome is different. So far I use no iv to facilitate.
1
1487
by: RJ | last post by:
The 2.0 Framework SDK only has examples where the Rijndael class instance provides the key. I've tried setting my own key value, making sure my key length matches the KeySize property of my Rijndael instance. I always get "invalid key". Am I misunderstanding the concept - if I don't set and keep my own key, how will I be able to decrypt later? Any ideas or example would be much appreciated. RJ
4
4783
by: Sylvie | last post by:
http://www.obviex.com/samples/Encryption.aspx According to this link, I am using Rijndael Encryption & Decryption Algorithms, But I want my encrypted strings just CAPS string and just alphanumeric values ABC...Z and 123...90, no other chars I want, what should I do ? or what other algos I must use, Thanks
3
2563
by: KBS Developer | last post by:
Hi, I can encrypt without any problem but while decrypting I got junk. I've read the other thread about getting junk but that is not my case. Here is the sample code: private Rijndael GetKBSAlgorithm() { Rijndael rijndaelAlgorithm = Rijndael.Create(); rijndaelAlgorithm.IV = Convert.FromBase64String(tbIV.Text);
0
7884
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8024
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6681
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5844
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5423
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3880
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3921
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1493
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.