Hello

I have a C++ program which is supposed to encrypt plaintext via keyboard input using AES-CCMP algorithm. The problem is that whatever plaintext I enter, it displays same ciphertext. The code listing is about 1500 lines. How can I post my code so that programmers can help me out?

Now including the code as .cpp attachment. Plz help me out.

I ran your program twice, both times with a key of "a". One time I had the message as "a" and another time as "b". Results for text "a" are:

Enter your text here: a

Enter your key here: a

	Plaintext MPDU in transmission order, without CRC
		00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
		00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
		00 00 00 00 00 00 00 00 00 

	PN (48 bit, hexadecimal)

		060504030201

	KEY (lsb first, msb last)
		61 00 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf

	Ciphertext MPDU in transmission order, with CRC
		00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
		00 00 00 00 00 00 00 00 01 02 00 a0 03 04 05 06 
		43 23 66 41 60 a7 60 ed 08 d0 ce f5 b3 fa ec bb 
		f7 f1 51 c5 dc 85 78 83 c4 f2 29 d5 f9

For text "b", it's this:

Enter your text here: b

Enter your key here: a

	Plaintext MPDU in transmission order, without CRC
		00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
		00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
		00 00 00 00 00 00 00 00 00 

	PN (48 bit, hexadecimal)

		060504030201

	KEY (lsb first, msb last)
		61 00 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf

	Ciphertext MPDU in transmission order, with CRC
		00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
		00 00 00 00 00 00 00 00 01 02 00 a0 03 04 05 06 
		43 23 66 41 60 a7 60 ed 08 d0 ce f5 b3 fa ec bb 
		f7 f1 51 c5 dc 85 78 83 c4 f2 29 d5 f9

Looks to me like your problem is before the encryption stage. You have all zeroes for the plain text, if I am reading it right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.