[botan-devel] botan-devel Digest, Vol 87, Issue 8

Sharada Acharya Sharada_Acharya at persistent.co.in
Fri Apr 27 09:56:41 EDT 2012


Hi Jack,

Thanks for the information! I understand it better now...

I am trying to add support for string data for FPE using the Botan library.
To check if Botan FPE implementation support string data, I wrote an application program where I converted,

1) string output into byte
2) byte output into BigInt

using pipes and the BigInt interface. I used this BigInt number to as an argument to fe1_encrypt(), reverse way for decrypt.
>From your explanation it seems that this scheme surely won't work.

> As I hinted with the dictionary example, yes, the FPE scheme supports
> string data, but it requires you to be able to order and number the
> possible inputs. Since this depends on what the application inputs
> are, it is difficult to support directly in the library.

By this what I understood is, for example if the domain of input is {a,b,c,d,e,f,g,h,i,j}. For each of these 10 characters I assign a number/weight, say 1,2.. upto 10. Now, plaintext = abcde; after mapping every character to the corresponding number it becomes 12345. I send this number as an argument to fe1_encrypt(); reverse way at the time of decrypt. Is my understanding correct ? After performing mathematical operations this number, whatever number comes out as a ciphertext, will that map to actual weights assigned to these characters ?

Thanks,
Sharada Acharya


-----Original Message-----
From: botan-devel-bounces at randombit.net [mailto:botan-devel-bounces at randombit.net] On Behalf Of botan-devel-request at randombit.net
Sent: Thursday, April 26, 2012 9:30 PM
To: botan-devel at randombit.net
Subject: botan-devel Digest, Vol 87, Issue 8

Send botan-devel mailing list submissions to
	botan-devel at randombit.net

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.randombit.net/mailman/listinfo/botan-devel
or, via email, send a message with subject or body 'help' to
	botan-devel-request at randombit.net

You can reach the person managing the list at
	botan-devel-owner at randombit.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of botan-devel digest..."


Today's Topics:

   1. Questions of Botan Crypto Library (Sharada Acharya)
   2. Re: Questions of Botan Crypto Library (Jack Lloyd)


----------------------------------------------------------------------

Message: 1
Date: Thu, 26 Apr 2012 10:24:17 +0000
From: Sharada Acharya <Sharada_Acharya at persistent.co.in>
To: "botan-devel at randombit.net" <botan-devel at randombit.net>
Subject: [botan-devel] Questions of Botan Crypto Library
Message-ID:
	<7A105074D134E64BAEEA168771B16E451F5D70A7 at HJ-MBX1.persistent.co.in>
Content-Type: text/plain; charset="us-ascii"

Hi ,

I am using the Botan crypto library for the purpose of FPE. I ran sample application of FPE given in the examples.
I have few questions regarding the FPE implementation -


1)      Does this FPE implementation support string data or is the support limited to numeric data only ?
If it doesn't provide the support for string data, is it possible to write an application on top of this library which will add support for the same ?


2)      In the standard FPE specifications, it is mentioned that the length of the input text and the cipher text is same, i.e. length is preserved.

On the contrary, I found that Botan FPE gives a cipher text which is of different length than the input text. Is this behavior expected ?



3)      In the sample program of FPE (doc/examples/fpe.cpp), it seems that the length of cipher text depends on the parameter 'n' (first argument to fe1_encrypt). Length of the ciphertext always comes out to be equal the length of 'n', irrespective of the length of the input text. As per the documentation, it encrypts X modulo n, where X is input number. I tried running the program by changing the values of 'n'. When n=1, the program crashes. The length of the output is also not consistent when the value of n = 3.  Can the value of 'n' be used as the configuration parameter for length of ciphertext ?

Could you please provide answers to the above questions ?

Thanks!

Regards,
Sharada Acharya


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
-------------- next part --------------
HTML attachment scrubbed and removed

------------------------------

Message: 2
Date: Thu, 26 Apr 2012 07:46:17 -0400
From: Jack Lloyd <lloyd at randombit.net>
To: Botan development list <botan-devel at randombit.net>
Subject: Re: [botan-devel] Questions of Botan Crypto Library
Message-ID: <20120426114616.GF9472 at randombit.net>
Content-Type: text/plain; charset=us-ascii

On Thu, Apr 26, 2012 at 10:24:17AM +0000, Sharada Acharya wrote:

> 1)      Does this FPE implementation support string data or is the support limited to numeric data only ?
> If it doesn't provide the support for string data, is it possible to write an application on top of this library which will add support for the same ?

> 2)      In the standard FPE specifications, it is mentioned that the length of the input text and the cipher text is same, i.e. length is preserved.
> 
> On the contrary, I found that Botan FPE gives a cipher text which is of different length than the input text. Is this behavior expected ?

The FPE scheme currently in botan is based around what is called
rank-then-encipher. First, each possible input (whatever it might be)
is ranked - assigned an integer value 0, 1, 2, ... n. Then, encryption
of a particular input P is done modulo n using FPE. Then, the output
of the encryption process, C, is de-ranked, converting that integer
back to the original input set.

So you see that length preservation is not a requirement for FPE. For
instance one might use FPE to encrypt dictionary words. Each
ciphertext would be a dictionary word, preserving the format, but the
encryption would not be length preserving. In other cases, such as tax
ID numbers, the length is intrinsic to the format and thus the length
is preserved as a side effect of preserving the format.

As I hinted with the dictionary example, yes, the FPE scheme supports
string data, but it requires you to be able to order and number the
possible inputs. Since this depends on what the application inputs
are, it is difficult to support directly in the library.
> 
> 3)      In the sample program of FPE (doc/examples/fpe.cpp), it seems that the length of cipher text depends on the parameter 'n' (first argument to fe1_encrypt). Length of the ciphertext always comes out to be equal the length of 'n', irrespective of the length of the input text. As per the documentation, it encrypts X modulo n, where X is input number. I tried running the program by changing the values of 'n'. When n=1, the program crashes. The length of the output is also not consistent when the value of n = 3.  Can the value of 'n' be used as the configuration parameter for length of ciphertext ?

Yes, n is configurable. The example n value is set for a 15 digit
input which is consistent with a typical credit card number (without
the final checksum digit, which is removed by the rank operation).

The FE1 FPE scheme requires that n be factored into two numbers,
ideally of about the same size. That is impossible if n is prime. I
would add that for n=1, you're saying you are encrypting a single
possible input onto a single possible output...

-Jack


------------------------------

_______________________________________________
botan-devel mailing list
botan-devel at randombit.net
http://lists.randombit.net/mailman/listinfo/botan-devel


End of botan-devel Digest, Vol 87, Issue 8
******************************************

DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.



More information about the botan-devel mailing list