# Certificateless cryptography Implementation

Hello guys I am trying to implement Certificateless Cryptography algorithm with reference to this base paper. Right now I am trying to implement the code in java. There are some points specified in PDF which I didn't understood. I need some help to understand how should I implement them.

The points are as follows (kindly correct me if I misunderstood any point):

1. Pick a generator of $g$ of $Z_p^*$ with order $q$. -> for this step I just followed this link as reference and calculated $g$ as $g^{(p−1)/2}\bmod p=1$ where $g$ is prime number.
2. Choose cryptographic hash in the paper they have specified that they had used SHA-1 to generate hash. I can generate the hash values but I am not able to reproduce the hash functions given in base paper, does $(0,1)^*$ is used to represent binary.
3. Hash usually generates hexadecimal values do I need to convert them into decimal for Raise operation i.e. power
4. Does the hash needs to be of fixed size or not.
5. Sorry to say but in summary I didn't understood the encryption part of this paper. I know stackexchange is not made to explain how it works but I just want a proper guide line so that I can implement the application.

As far I understood the paper (very briefly) it looks like it's talking about the default asymmetric encryption without the CA (certificate authorities). However - it seems there's the SEM part of the system which seems to know the private keys (???) and acts as the revocation authority.

I believe you can use the default Java crypto API without needing to implement it yourself. In fact I'd discourage you to do that until you REALLY know what are you doing, how/what to properly encrypt with the public key, etc. For the start - I'd advice to learn something about the cryptography elements and implementations, what you see in the papers are mathematical models of common crypto elements.

As it goes for your questions:

Pick a generator of g of Z∗p with order q. -> for this step I just followed this link as reference and calculated g as g(p−1)/2modp=1 where g is prime number.

It means to choose you keysize (so - e.g. 2048 bit keys) and generate a private key (p, q) and public key (p*q). Using a KeyPairGenerator should be effective.

Choose cryptographic hash in the paper they have specified that they had used SHA-1 to generate hash. I can generate the hash values but I am not able to reproduce the hash functions given in base paper, does (0,1)∗ is used to represent binary.

Any reasonable hash function will do - so lets assume SHA-1. All numbers are binary for the computer, its only their 'human' representation how you can display them (decimal, hex, ..)

Hash usually generates hexadecimal values do I need to convert them into decimal for Raise operation i.e. power

Hash returns a bit array (byte[]), you can use the BigInteger class to raise it to certain power. Don't forget all operations are under the discrete group (so you do ($g^a$ mod p). About the steps described in the paper - you need to 'sign' the hash. And after the decryption, the signature is compared with a newly computed signature so data integrity is ensured.

As for the topic - I'd advice to spend some time understanding the default cryptography and asymmetric encryption (for this case) and usage practices and it will be much easier for you to follow the paper. The problem with the cryptography is that something is misunderstood or neglected, it will completely break the security.

In all cases - have fun :)

• Thanks for taking your precious time, and sorry for my late reply. As far your point of using java's default cryptography package to simulate the algorithm in paper, I can implement but this is my final year project is dependent on this base paper, my instructor won't accept with java's concept they need the same algorithm to implement. Is there any book you recommend for learning mathematical concept so that I can understand the math behind it and try to implement. – Vighanesh Gursale Mar 15 '16 at 8:07
• Then at least see how it is implemented. All the operations are done on the discrete group p ( effectively you do modulo p). However - I see pointless to implement yourself a hash function (sha, md5, whatever) when it needs to keep all cryptographic properties (collision resistance, ...) – gusto2 Mar 15 '16 at 9:00
• Correct me if I am wrong, you want to tell that I should not create hash function just use the hash wherever it is ask to use in algorithm, or something else. – Vighanesh Gursale Mar 15 '16 at 11:07