Cryptography Reference
In-Depth Information
else
s := stringposint(seed2)
end if;
q := RSAPrime(k, s, min = m);
n := p*q;
key := [n, [p, q]];
if format = decimal then
key
elif format = hex then
LowerCase ∼∼ (convert ∼∼ (key, hex))
else
error "Unrecognized key format"
end if
end proc:
We also need a function to generate the system parameter u
n that will
be used to turn the hash value of a user identity into a quadratic residue modulo n
in case it is not already one. This value will be generated by the function GenPar
below on input the prime factors of the modulus plus an optional parameter to tell
the function whether the output will be decimal or hexadecimal.
> GenPar := proc(p::posint, q::posint, {format::name := hex})
uses RandomTools:-MersenneTwister;
local n, legp, legq, u;
n := p*q;
SetState();
legp := 1;
legq := 1;
while legp = 1 or legq = 1 do
u := GenerateInteger(':-range' = 1 .. n-1);
legp := numtheory:-legendre(u, p);
legq := numtheory:-legendre(u, q)
end do;
if format = decimal then
u
elif format = hex then
StringTools:-LowerCase ∼∼ (convert ∼∼ (u, hex))
else
error "Unrecognized key format"
end if
end proc:
We now have in place all the ingredients we need to implement the Cocks IBE
scheme. We start with the function that implements the Setup algorithm. This is the
function CocksIBESetup below, which collects the data computed by the previous
two functions and outputs the master key and the u parameter (see Definition 10.6
above). The master key, in turn, consists of the master public key—namely, the RSA
modulus n —and the master private key, i.e., the factorization of the modulus. The
input parameters of the function are the same as in GenModulus and the output is a
3-element list. The first item in the list is the modulus, the second a list with the two
prime factors of the modulus, and the third element is the u -parameter. These values
may be returned by the function in either decimal or hexadecimal format, with the
latter being the default.
QN
> CocksIBESetup := proc(k::posint, seed1::{posint, string}, seed2::{posint, string},
{format::name := hex})
local m, p, q, u;
m := GenModulus(args);
p := stringposint(m[2][1]);
q := stringposint(m[2][2]);
u := GenPar(p, q, ':-format' = format);
Search WWH ::




Custom Search