Archive for the 'Crypto' Category

20
Jan
09

Picking up where I left

Continuing my work here, here, here, here and here, I’m going to finish this plaintext converting thing, and divide the messages into several points, multiply it with k (same k or different k? on the same elliptic curve), then reconstruct the points into the original text.

19
Jan
09

Zooming in: Base64Decoder

I’m zooming in the process of converting plaintext to a point in elliptic curve. And from the examples of Crypto++ usage, the plaintext is encoded to a base64 after it’s being encrypted, and decoded before it’s being decrypted.

The inheritance diagram for Base64Decoder:

From Research

The encoding process:

From Research

The codes:

// Encryption
Encryptor.Encrypt( rng, reinterpret_cast( PlainText.c_str() ), PlainTextLength, CipherText );

// Base 64 Encoding
CryptoPP::Base64Encoder Encoder;
Encoder.Put( CipherText, CipherTextLength );
Encoder.MessageEnd();

// Scratch for Base 64 Encoded Ciphertext
unsigned int EncodedTextLength = Encoder.MaxRetrievable();
byte* EncodedText = new byte[ EncodedTextLength + 1 ]; /* + 1 for NULL termination */
if( NULL == EncodedText ) { throw std::string( “Base64 EncodedText Allocation Failure” ); }
::memset( EncodedText, 0xFB, EncodedTextLength );
EncodedText[ EncodedTextLength ] = ”;

// Base 64 Ciphertext
Encoder.Get( EncodedText, EncodedTextLength );

// Diagnostics
std::cout << “Base 64 Encoded Ciphertext (” << EncodedTextLength << ” bytes):”;
std::cout << std::endl << EncodedText << std::endl;

// Base 64 Decoding
CryptoPP::Base64Decoder Decoder;
Decoder.Put( EncodedText, EncodedTextLength );
Decoder.MessageEnd();

// Scratch for Base 64 Decoded Ciphertext
unsigned int DecodedTextLength = Decoder.MaxRetrievable();
byte* DecodedText = new byte[ DecodedTextLength ];
if( NULL == DecodedText ) { throw std::string( “Base64 DecodedText Allocation Failure” ); }
::memset( DecodedText, 0xFB, DecodedTextLength );

// Ciphertext is no longer Encoded
Decoder.Get( DecodedText, DecodedTextLength );

//
// At this point, RecoveredText64 = CipherText
//
assert( DecodedTextLength == CipherTextLength );
assert( 0 == ::memcmp( DecodedText, CipherText, CipherTextLength ) );

// Scratch for Decryption
unsigned int RecoveredTextLength = Decryptor.MaxPlaintextLength( CipherTextLength );
if( 0 == RecoveredTextLength ) { throw std::string(“ciphertextLength is not valid (too long or too short)”); }

// Decryption Buffer
char* RecoveredText = new char[ RecoveredTextLength ];
if( NULL == RecoveredText ) { throw std::string( “RecoveredText CipherText Allocation Failure” ); }
::memset( RecoveredText, 0xFB, RecoveredTextLength );

// Decryption
Decryptor.Decrypt( rng, CipherText, CipherTextLength, reinterpret_cast( RecoveredText ) );

// Diagnostics
std::cout << “Recovered text (” << RecoveredTextLength << ” bytes):” << std::endl;
std::cout << “‘” << RecoveredText << “‘” << std::endl;

Questions:

  1. Why should the plaintext be encoded to base64?
  2. Why the plaintext is encoded after it’s encrypted not the vice versa?
30
Dec
08

Book review: Nothing left to do for my phd thesis

I have just finished skimming through “Elliptic Curve Cryptography for Constrained Devices – Algorithms, Architectures and Practical Implementation” by Sandeep S. Kumar.

The guy have done software design of ECDH key exchange on an 8-bit processor, hardware/software co-design on extensions for an 8-bit processor and 32-bit processor, hardware design for optimal digit multipliers for F_{2^{m}} ,  hardware design for ECC in the frequency domain and hardware design for tiny ECC processor over F_{2^{m}} !!!

He just did everything! The open problems he mentioned at the end of the book was those stuff related to optimizing power to be extremely efficient on constrained devices, thus to make it strong against the side channel attacks.

Oh well…

30
Dec
08

Yes, it is implementable, but how?

Reading the third chapter of this book, I’m astonished that ECC (ECDH) is implementable on Chipcon CC1010 chip which consists of an 8-bit 8051 processor core with a built-in radio transceiver and a hardware DES engine. It containts 32 kb of flash memory for storing programs, 2048 bytes of SRAM external to the 8051 core (XRAM), and 128 bytes of internal SRAM (IRAM).

Now the question is, without using any additional extra hardware, how to build codes calculating those complex operation of ECC that fits those small memories???

[screaming in horror...]

29
Dec
08

Which class to use?

This is the class structure of Crypto++ Library

picture-1

And then when I’m going to implement PK_Encryptor, which one to use???

picture-2

Which base class to use, when to implement, what scheme to choose? Still not clear which are the abstract classes. This library is superb but makes my head going to explode :D

28
Dec
08

phd student on vacation

Finally back to coding, in some short precious time during the day after finishing domestic chores. This phd student is being a bit distracted during the holiday, but this site really helps her to compile some codes on using ECC encryption using Crypto++ Library. Hope this will be a good start heading to somewhere, at least it is a good thing she still can do some research while she’s away from the lab :)

One more week left for holiday, and still haven’t finished so many things. I’m not going to write the to do list here, it’s too depressing!

25
Dec
08

Newcomers to the bookshelf :)

Forgot to post an update about me shopping some books, really cool ones :)

1. The “bible” of ECC: “Guide to Elliptic Curve Cryptography” – Darrel Hankerson, Alfred Menezes, Scott Vanstone

2. A very detail and theoritical book about elliptic curves: “Elliptic Curves – Number Theory and Cryptography” – Lawrence C. Washington

3. The most related book to be the reference of my phd thesis: “Elliptic Curve Cryptography for Constrained Devices – Algorithms, Architectures and Practical Implementations” – Sandeep S. Kumar

Happy holiday, everybody.

I’m going to spend the holiday with my new buddies ;)

07
Dec
08

My Research Analogy

I have posted some thoughts about my research to my less-strict and less-formal personality blogs here and here.

Enjoy ;)

23
Nov
08

Bibdesk: 99 publications

picture-13

I’ve been documenting papers on ECC and sort them and give them keywords and link them to my research proposal document in Lyx and got a big headache and dream about these papers whenever I sleep… zzzzz… arrrghghghg…..

Don’t know if the number of publications has been collected (I don’t read ALL of them, but AT LEAST i read the titles, abstracts and conclusions :P ) would make it easier to pass the quals… but i still feel distracted with the ideas on my head scattered and far away from convergence, aaaaaaaaaaaaa!!!

Yeaaaaa, it almost reaches a hundred…

17
Nov
08

Compiling Crypto++

picture-3

Has successfully compiled Crypto++ (pfffh, finally ;) ). I made a very simple code (above), and standard g++ command for compiling did not work, until the library being installed to the library directory.

Here’s how to install the crypto package:

  1. mkdir crypto
  2. mv cryptopp552.zip ./crypto
  3. cd crypto
  4. unzip cryptopp552.zip
  5. make
  6. sudo cp libcryptopp.a /usr/lib/
  7. sudo mkdir /usr/include/cryptopp
  8. sudo cp *.h /usr/include/cryptopp/

Then compile it:

g++ -lcryptopp cryptopptest.cpp

And run it:

./a.out

I decide to do some experiments using Crypto++ for the following reasons:

  1. It supports ECDSA, ECDH, ECIES
  2. It supports both binary and prime curves
  3. The library comes with domain parameters defined by NIST and SECG
  4. Great support for manipulating data
  5. Precomputation is supported
  6. Crypto++ is trying to receive NIST’s certification of ECDSA



Blog Stats

  • 11,249 hits

Categories

 

December 2009
M T W T F S S
« Mar    
 123456
78910111213
14151617181920
21222324252627
28293031