When i compute the time complexity of cipher text policy attribute based encryption CP-ABE . I found it O(1) by tracing each step in code which mostly are assignments operations. Is it possible that the time complexity of CP-ABE be O(1) or i have a problem. the code that i used is the following, where ITERS=1.

public static List encrypt(String policy, int secLevel, String type, byte[] data, int ITERS){ double results[] = new double[ITERS]; DETABECipher cipher = new DETABECipher(); long startTime, endTime; List list = null; for (int i = 0; i < ITERS; i++){ startTime = System.nanoTime(); list = cipher.encrypt(data, secLevel,type, policy); endTime = System.nanoTime(); results[i] = (double)(endTime - startTime)/1000000000.0; } return list; } public List encrypt(byte abyte0[], int i, String s, String s1) { AccessTree accesstree = new AccessTree(s1); if(!accesstree.isValid()) { System.exit(0); } PublicKey publickey = new PublicKey(i, s); if(publickey == null) { System.exit(0); } AESCipher.genSymmetricKey(i); timing[0] = AESCipher.timing[0]; if(AESCipher.key == null) { System.exit(0); } byte abyte1[] = AESCipher.encrypt(abyte0); ABECiphertext abeciphertext = ABECipher.encrypt(publickey, AESCipher.key, accesstree); timing[1] = AESCipher.timing[1]; timing[2] = ABECipher.timing[3] + ABECipher.timing[4] + ABECipher.timing[5]; long l = System.nanoTime(); LinkedList linkedlist = new LinkedList(); linkedlist.add(abyte1); linkedlist.add(AESCipher.iv); linkedlist.add(abeciphertext.toBytes()); linkedlist.add(new Integer(i)); linkedlist.add(s); long l1 = System.nanoTime(); timing[3] = (double)(l1 - l) / 1000000000D; return linkedlist; } public static byte[] encrypt(byte[] paramArrayOfByte) { if (key == null) { return null; } byte[] arrayOfByte = null; try { long l1 = System.nanoTime(); cipher.init(1, skey); arrayOfByte = cipher.doFinal(paramArrayOfByte); long l2 = System.nanoTime(); timing[1] = ((l2 - l1) / 1.0E9D); iv = cipher.getIV(); } catch (Exception localException) { System.out.println("AES MODULE: EXCEPTION"); localException.printStackTrace(); System.out.println("---------------------------"); } return arrayOfByte; } public static ABECiphertext encrypt(PublicKey paramPublicKey, byte[] paramArrayOfByte, AccessTree paramAccessTree) { Pairing localPairing = paramPublicKey.e; Element localElement1 = localPairing.getGT().newElement(); long l1 = System.nanoTime(); localElement1.setFromBytes(paramArrayOfByte); long l2 = System.nanoTime(); timing[3] = ((l2 - l1) / 1.0E9D); l1 = System.nanoTime(); Element localElement2 = localPairing.getZr().newElement().setToRandom(); Element localElement3 = localPairing.getGT().newElement(); localElement3 = paramPublicKey.g_hat_alpha.duplicate(); localElement3.powZn(localElement2); localElement3.mul(localElement1); Element localElement4 = localPairing.getG1().newElement(); localElement4 = paramPublicKey.h.duplicate(); localElement4.powZn(localElement2); l2 = System.nanoTime(); timing[4] = ((l2 - l1) / 1.0E9D); ABECiphertext localABECiphertext = new ABECiphertext(localElement4, localElement3, paramAccessTree); ShamirDistributionThreaded localShamirDistributionThreaded = new ShamirDistributionThreaded(); localShamirDistributionThreaded.execute(paramAccessTree, localElement2, localABECiphertext, paramPublicKey); timing[5] = ShamirDistributionThreaded.timing; return localABECiphertext; } } public ABECiphertext(Element element, Element element1, AccessTree accesstree) { c = element; cp = element1; cipherStructure = new HashMap(); tree = accesstree; } public void execute(AccessTree accesstree, Element element, ABECiphertext abeciphertext, PublicKey publickey) { pairing = publickey.e; ct = abeciphertext; PK = publickey; countDownLatch = new CountDownLatch(accesstree.numAtributes); timing = 0.0D; double d = System.nanoTime(); Thread thread = new Thread(new Distribute(abeciphertext, accesstree.root, element)); thread.start(); try { countDownLatch.await(); long l = System.nanoTime(); timing = ((double)l - d) / 1000000000D; synchronized(mutex) { } } catch(Exception exception) { exception.printStackTrace(); } }

More Amal Hashim's questions See All
Similar questions and discussions