Jyothirmayee, P | 1 Dec 2004 16:33
Picon
Favicon

Supported on Linux?

Hi,

I am working for HP and we are looking for a crpyptographic library
to use on Linux (RedHat) operating system which supports the
following algorithms :

Hashing Algorithm : SHA-1
MAC algorithm : HMAC SHA1
Signature algorithm : RSA-PSS

I would like to know

1) If Crypto++ library can be used on Linux ?
2) Is the algorithm RSA-PSS implemented in this library?

I found some traces of RSA-PSS in the source files but could not confirm
if it is implemented or not. Please let me know.
 
Looking forward for your reply.

Regards,
Jyothi

James Vanns | 1 Dec 2004 17:53
Picon
Picon
Favicon

Re: Supported on Linux?

On Wed, 2004-12-01 at 21:03 +0530, Jyothirmayee, P wrote:
> Hi,

Hello.

> I am working for HP and we are looking for a crpyptographic library 
> to use on Linux (RedHat) operating system which supports the 
> following algorithms :
> 
> Hashing Algorithm : SHA-1 

Yes.

> MAC algorithm : HMAC SHA1 

Yes.

> Signature algorithm : RSA-PSS

It seems it does...

> I would like to know 
> 
> 1) If Crypto++ library can be used on Linux ? 

Yes. I am using it in several projects.

> 2) Is the algorithm RSA-PSS implemented in this library?

I've not used it personally so someone else would be better fit to
reply. However, RSA-PSS was defined in PKCS #1 v2.1 and Wei Dai (on his
website) refers to a PKCS #1 v2.0. But as I said, perhaps someone else
would be better fit to reply on this one...

Regards

Jim Vanns

> 
> I found some traces of RSA-PSS in the source files but could not
> confirm 
> if it is implemented or not. Please let me know.
>   
> Looking forward for your reply.
> 
> Regards, 
> Jyothi
> 
--

-- 
James Vanns BSc (Hons) MCP
Linux Systems Administrator
Software Engineer (Linux / C & C++)
Canterbury Christ Church University College
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370

Sean Radford | 2 Dec 2004 09:13
Picon

Re: Supported on Linux?

Jyothirmayee, P wrote:

> Hi,
>
> I am working for HP and we are looking for a crpyptographic library
> to use on Linux (RedHat) operating system which supports the
> following algorithms :
>
> Hashing Algorithm : SHA-1
> MAC algorithm : HMAC SHA1
> Signature algorithm : RSA-PSS
>
> I would like to know
>
> 1) If Crypto++ library can be used on Linux ?
> 2) Is the algorithm RSA-PSS implemented in this library?
>
> I found some traces of RSA-PSS in the source files but could not confirm
> if it is implemented or not. Please let me know.
>  
> Looking forward for your reply.
>
> Regards,
> Jyothi
>
You may also want to take a look at: http://botan.randombit.net/

Sean

--

-- 
Dr. Sean Radford, MBBS, MSc
sradford <at> bladesystems.co.uk
http://bladesys.demon.co.uk/ 

Dag Ran | 2 Dec 2004 18:50
Picon
Favicon

RSA Keys

Hi Folks,
 
I would like to generate RSAES_PKCS1v1 keys without using any encoding. I am able to generate keys using both Base64 and Hex encoding, based on the code found in test.cpp, this is the only one causing me grief right now (RSA keys without encoding). Thanks in advance for any help.
 
Best Regards,
 
D

Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
Dag Ran | 2 Dec 2004 21:38
Picon
Favicon

RE: RSA Keys

I figured it out, at least I think I did. I am using TransparentFilter in place of Base64Encoder or HexEncoder. My keys appear to be in their raw format, so if someone could at least confirm that this is correct that would be great. Thanks again!
 
D.

Do you Yahoo!?
Meet the all-new My Yahoo!
Favicon

RE: memory leak in AES encryption

Hi Youlong,

I would suspect your usage of COM. Instead of using a CComBSTR, try any
array of OLECHAR.

The following looks like a nice reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html
/vcconprogrammingwithccombstr.asp

Note the following from the above (I see your using the m_str member):

Memory Leak Issues
Passing the address of an initialized CComBSTR to a function as an [out]
parameter causes a memory leak.

...

> I wonder why I have so many problems
Par for the course.

Jeffrey Walton

-----Original Message-----
From: 曹玉龙 [mailto:ylcao <at> travelsky.com] 
Sent: Thursday, December 02, 2004 12:40 AM
To: Walton, Jeffrey (Contractor)
Subject: memory leak in AES encryption

Hi, Jeff

	I am so sorry. It took so much your time to help me to solve
problems. But I could not send mails to cryptopp-announce <at> lists.sourceforge.
net. Every times he replied "Your mail to 'Cryptopp-announce' Is being held
until the list moderator can review it for approval."

	So I have to still send mails to you. I wonder why I have so many
problems ^_^

	I wrote a function to encrypt BSTR with AES algorithm. While calling
this function, I found memory leak.
	I repeatedly called this function for 1000 times, the length of
plain if 512KB, about 130MB memory was taked by my application. It may be a
horrible news.
	Does anybody could give me some advices. Thank you

	The following is my code.

STDMETHODIMP CAESFunc::Encrypt(BSTR sPlain, BSTR *sCipher)
{
	CComBSTR *strTemp=new CComBSTR();
	byte *pBuffer, *pOutBuf;
	int iLen;

	strTemp->Empty();
	strTemp->AppendBSTR(sPlain);
	pBuffer = (byte*)malloc(strTemp->Length()<<1);
	iLen = WideCharToMultiByte(CP_ACP, NULL, strTemp->m_str, 
		strTemp->Length(), (char*)pBuffer, strTemp->Length()<<1,
NULL, NULL);

	CBC_Mode<AES>::Encryption myAES(m_AESKey, m_iKeySize, m_AES_IV);
	StreamTransformationFilter filterEnc(myAES, 0,
StreamTransformationFilter::PKCS_PADDING);
	filterEnc.Put((byte*)pBuffer, iLen);
	filterEnc.MessageEnd();

	pOutBuf = (byte*)malloc(iLen + 16);
	iLen = filterEnc.Get(pOutBuf, iLen + 16);
	Base64Encoder objCoder;
	objCoder.Put(pOutBuf, iLen);
	objCoder.MessageEnd();
	free(pBuffer);
	pBuffer = (byte*)malloc(iLen*2);
	iLen = objCoder.Get(pBuffer, iLen*2);

	free(pOutBuf);
	pOutBuf = (byte*)malloc(iLen * 2);
	iLen = mbstowcs((unsigned short*)(pOutBuf), (const char*)pBuffer,
iLen);
	strTemp->Empty();
	strTemp->Append((unsigned short*)pOutBuf, iLen);
	*sCipher = strTemp->Copy();
	free(strTemp);
	free(pBuffer);
	free(pOutBuf);

	return S_OK;
}

Yulong Cao

Samuel Mota | 6 Dec 2004 19:32

Really simple DES encryption


Hi,

Sorry if this is a stupid question, but I know almost nothing about cryptography theory but I need
to encrypt and decrypt a message using DES ....

But for now I can't figure out what should be the Initialization Vector ... the guys who encrypted
the msg have no idea wich iv was used (they have no idea what is iv since they are using a product
built in encryption api call) ... I have read somewhere that with DES the IV should be the key
vector, but I'm not getting their result when encrypting the same message with the same key.

The code bothered from the FAQ ... note that plaintext and key are already created as a byte array
.... could someone point me to some direction? (the expected result is 0x21 0x79 0xAD 0xB9 0x24 0x59
0xEE 0xE3)

      //lenght Needs to be a multiple of 8
      byte plaintext[] = { 0x06, 0x12, 0x34, 0x56, 0xFF, 0xFF, 0xFF, 0xFF };
      byte * ciphertext;
      byte * result;

      HexEncoder hexEncoder3;
      unsigned int outputLength;

      const byte key[] = { 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61 };

      // encrypt
      CBC_Mode<DES>::Encryption ecbEncryption(key,DES::DEFAULT_KEYLENGTH, key);
      StreamTransformationFilter encryptor(ecbEncryption,
NULL,StreamTransformationFilter::NO_PADDING);
      encryptor.Put(plaintext, sizeof(plaintext));
      encryptor.MessageEnd();

      outputLength = encryptor.MaxRetrievable();
      ciphertext = new byte[outputLength];
      encryptor.Get(ciphertext, outputLength);

      cout << "outputLength is: " << outputLength << endl;

      hexEncoder3.Put(ciphertext, outputLength);
      hexEncoder3.MessageEnd();
      byte * pData3;
      pData3 = new byte[outputLength*2];
      hexEncoder3.Get(pData3, outputLength*2);

      int j=0;
      cout << "Encrypted Data is: ";
      for (j=0; j<(outputLength*2); j++) {
             cout << pData3[j];
      }
      cout << endl;

      // now decrypt
      CBC_Mode<DES>::Decryption ecbDecryption(key,
                                          DES::DEFAULT_KEYLENGTH, key);
      StreamTransformationFilter decryptor(ecbDecryption, NULL,
                                          StreamTransformationFilter::NO_PADDING);
      decryptor.Put(ciphertext, outputLength);
      decryptor.MessageEnd();

      outputLength = decryptor.MaxRetrievable();
      result = new byte[outputLength];
      decryptor.Get(result, outputLength);

      cout << "ciphertext size is " << sizeof(ciphertext) << endl;
      cout << "recovered plaintext is " << result << endl;

      delete [] ciphertext;
      delete [] result;

      return 0;

Favicon

RE: Really simple DES encryption

Hi Samuel,

Follow the thread below. It has some nice commentaries on DES, IVs, etc.

http://www.mail-archive.com/cryptopp-list <at> eskimo.com/msg01680.html

Jeffrey Walton

-----Original Message-----
From: Samuel Mota [mailto:SMota <at> hypercom.com] 
Sent: Monday, December 06, 2004 1:32 PM
To: cryptopp-list <at> eskimo.com
Subject: Really simple DES encryption

Hi,

Sorry if this is a stupid question, but I know almost nothing about
cryptography theory but I need
to encrypt and decrypt a message using DES ....

But for now I can't figure out what should be the Initialization Vector ...
the guys who encrypted
the msg have no idea wich iv was used (they have no idea what is iv since
they are using a product
built in encryption api call) ... I have read somewhere that with DES the IV
should be the key
vector, but I'm not getting their result when encrypting the same message
with the same key.

The code bothered from the FAQ ... note that plaintext and key are already
created as a byte array
.... could someone point me to some direction? (the expected result is 0x21
0x79 0xAD 0xB9 0x24 0x59
0xEE 0xE3)

      //lenght Needs to be a multiple of 8
      byte plaintext[] = { 0x06, 0x12, 0x34, 0x56, 0xFF, 0xFF, 0xFF, 0xFF };
      byte * ciphertext;
      byte * result;

      HexEncoder hexEncoder3;
      unsigned int outputLength;

      const byte key[] = { 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61 };

      // encrypt
      CBC_Mode<DES>::Encryption ecbEncryption(key,DES::DEFAULT_KEYLENGTH,
key);
      StreamTransformationFilter encryptor(ecbEncryption,
NULL,StreamTransformationFilter::NO_PADDING);
      encryptor.Put(plaintext, sizeof(plaintext));
      encryptor.MessageEnd();

      outputLength = encryptor.MaxRetrievable();
      ciphertext = new byte[outputLength];
      encryptor.Get(ciphertext, outputLength);

      cout << "outputLength is: " << outputLength << endl;

      hexEncoder3.Put(ciphertext, outputLength);
      hexEncoder3.MessageEnd();
      byte * pData3;
      pData3 = new byte[outputLength*2];
      hexEncoder3.Get(pData3, outputLength*2);

      int j=0;
      cout << "Encrypted Data is: ";
      for (j=0; j<(outputLength*2); j++) {
             cout << pData3[j];
      }
      cout << endl;

      // now decrypt
      CBC_Mode<DES>::Decryption ecbDecryption(key,
                                          DES::DEFAULT_KEYLENGTH, key);
      StreamTransformationFilter decryptor(ecbDecryption, NULL,

StreamTransformationFilter::NO_PADDING);
      decryptor.Put(ciphertext, outputLength);
      decryptor.MessageEnd();

      outputLength = decryptor.MaxRetrievable();
      result = new byte[outputLength];
      decryptor.Get(result, outputLength);

      cout << "ciphertext size is " << sizeof(ciphertext) << endl;
      cout << "recovered plaintext is " << result << endl;

      delete [] ciphertext;
      delete [] result;

      return 0;

ryan-crypto | 7 Dec 2004 09:10

Panama Validation Issues on Linux

I am working on the Gentoo crypto++ ebuilds and have run into a problem
and is the same as this post:
   http://www.escribe.com/software/crypto/m3861.html

The panama validation suite will not validate.  Has this problem been fixed?

I have uploaded the stdout and strace output here:
http://www.trolocsis.com/debug/
The debug output was generated with the default build flags:
    g++ -g -msse2 -pipe -c 3way.cpp

gcc version 3.3.3 20040412 (Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6)
and can be reproduced on 3.4.3

I tried moving the function prototype into the actual .cpp file, but it
does not appear to help.  Any ideas on solving this problem?

regards,
ryan phillips

Samuel Mota | 7 Dec 2004 14:47

RE: Really simple DES encryption


Hi,

Thanks Jeffrey. A few more newbie questions :)

For ECB mode the initialization vector is not used or it`s fixed somewhere?
(http://www.tropsoft.com/strongenc/des.htm;)
The simplest programm I wrote is encrypting and decrypting the message, but the encrypted does not
match with the expected (from the vendor test case application). The first 2 bytes matches, but
after that they are different. Any idea?

My App output:
Plain text is:
0x6 0x12 0x34 0x56 0xff 0xff 0xff 0xff
Cipher text is:
0x21 0x79 0xad 0xb9 0x24 0x59 0xee 0xe3
Decrypted text is:
0x6 0x12 0x34 0x56 0xff 0xff 0xff 0xff

The expected encrypted text is: 0x21 0x79 0x53 0xE1 0xC7 0xB1 0x72 0xAD

My source code:
#include "modes.h"
#include "des.h"
#include "hex.h"

#include <iostream>
#include <time.h>

#include <windows.h>

USING_NAMESPACE(CryptoPP)
USING_NAMESPACE(std)

int main()
{
      //declare help variables
      register int i;
      const unsigned int blocksize = 8;

      //declare key and plain text vector
      const byte key[] =
            { 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61 };
      byte plaintext[] =
            { 0x06, 0x12, 0x34, 0x56, 0xFF, 0xFF, 0xFF, 0xFF };

      //declare vectors to hole encrypted and decrypted messages
      byte *ciphertext;
      ciphertext = new byte[blocksize];
      byte *decryptedtext;
      decryptedtext = new byte[blocksize];

      //declare encryption and decryption objects
      ECB_Mode<DES>::Encryption ecbEncryption(key, DES::DEFAULT_KEYLENGTH, NULL);
      ECB_Mode<DES>::Decryption ecbDecryption(key, DES::DEFAULT_KEYLENGTH, NULL);

      //show plain text contents
      printf("Plain text is:\n");
      for(i=0; i<blocksize; i++) {
            printf("%#x ", plaintext[i]);
      }

      //encrypt
      ecbEncryption.ProcessData(ciphertext, plaintext, blocksize);

      //show encrypted message
      printf("\nCipher text is:\n");
      for(i=0; i<blocksize; i++) {
            printf("%#x ", ciphertext[i]);
      }

      //decrypt
      ecbDecryption.ProcessData(decryptedtext, ciphertext, blocksize);

      printf("\nDecrypted text is:\n");
      for(i=0; i<blocksize; i++) {
            printf("%#x ", decryptedtext[i]);
      }

      free(ciphertext);
      free(decryptedtext);

      return 0;
}

+ Samuel G. Mota
+ smota <at> hypercom.com
+ 55 (11) 4417 7093
+ Business Application Dpt.
+ Netset Serviços em Tecnologia
+ a Hypercom Company
+ http://www.hypercom.com


Gmane