Cryptography Reference
In-Depth Information
We next give the Cocks IBE encryption function, CocksIBEEncrypt .The
input parameters are the master public key, the u -parameter, the identity string,
the one-bit message given as an element of
and, finally, t0 and t1 for two
externally generated random values less than the modulus n . For demonstration
purposes, we have also included the possibility of letting Mersenne Twister generate
these values, which will happen if no arguments are passed to the function for the last
two parameters. In this case, the Mersenne Twister generator should be initialized by
means of RandomTools:-MersenneTwister:-SetState() prior to the
first use of the encryption function but, as mentioned on other occasions, this method
is not secure anyway. The output of CocksIBEEncrypt is the ciphertext in the
form of a list [[d0, c0], [d1, c1]] , corresponding to the format explained
in Definition 10.6, where the component numbers are given as decimal integers.
{
0
,
1
}
> CocksIBEEncrypt := proc(mpk::{posint, string}, u::{posint, string}, id::string,
message::(integer[0 .. 1]), t0::posint, t1::posint)
uses RandomTools:-MersenneTwister;
local n, v, R, b, x0, x1, d0, c0, d1, c1;
n := stringposint(mpk);
v := stringposint(u);
R := CocksIBEH(n, id);
b := (-1)ˆmessage;
if _params['t0'] = NULL then
x0 := GenerateInteger(':-range' = 1 .. n-1)
else
x0 := t0
end if;
if _params['t1'] = NULL then
x1 := GenerateInteger(':-range' = 1 .. n-1)
else
x1 := t1
end if;
d0 := (x0+R*(x0ˆ(-1) mod n)) mod n;
c0 := b*numtheory:-jacobi(x0, n);
d1 := (x1+v*R*(x1ˆ(-1) mod n)) mod n;
c1 := b*numtheory:-jacobi(x1, n);
[[d0, c0], [d1, c1]]
end proc:
It only remains to give the decryption function to complete this implementa-
tion of Cocks IBE. This is the function CocksIBEDecrypt below, whose input
parameters—all required—are the master public key, the user private key usk
corresponding to the user with identity string id , the identity string id itself,
and the ciphertext, given as a list in the format output by the preceding function
CocksIBEEncrypt . The output is one bit, given as an element of
{
0
,
1
}
.
> CocksIBEDecrypt := proc(mpk::{posint, string}, usk::{posint, string},
id::string, ciphertext::list)
local n, r, R, i, g, b;
n := stringposint(mpk);
r := stringposint(usk);
R := CocksIBEH(n, id);
if (rˆ2 mod n) = (R mod n) then
i:=0
 
Search WWH ::




Custom Search