View Javadoc
1   /*
2    * This file is part of the Civitas software distribution.
3    * Copyright (c) 2007-2008, Civitas project group, Cornell University.
4    * See the LICENSE file accompanying this distribution for further license
5    * and copyright information.
6    */
7   package civitas.crypto;
8   
9   import java.nio.charset.Charset;
10  import java.nio.charset.StandardCharsets;
11  import java.security.SecureRandom;
12  import java.util.Random;
13  
14  import civitas.util.CivitasBigInteger;
15  import civitas.util.CivitasBigIntegerFactory;
16  
17  public interface Constants {
18  	int CERTAINTY = 100;
19  
20  	CivitasBigInteger ZERO = CivitasBigIntegerFactory.obtain(0);
21  	CivitasBigInteger ONE = CivitasBigIntegerFactory.obtain(1);
22  	CivitasBigInteger TWO = CivitasBigIntegerFactory.obtain(2);
23  
24  	Random RANDOM = new SecureRandom();
25  
26  	String MESSAGE_DIGEST_ALG = "SHA-256";
27  	String MESSAGE_DIGEST_PROVIDER = null;
28  
29  	String SHARED_KEY_ALG = "AES";
30  	String SHARED_KEY_CIPHER_ALG = "AES";
31  	String SHARED_KEY_PROVIDER = "BC";
32  	int SHARED_KEY_LENGTH = 256;
33  
34  	String PUBLIC_KEY_ALG = "RSA";
35  
36  	String PUBLIC_KEY_CIPHER_ALG = "RSA/ECB/PKCS1Padding";
37  	String PUBLIC_KEY_SIGNATURE_ALG = "SHA512WithRSAEncryption";
38  	String PUBLIC_KEY_PROVIDER = "BC";
39  	int PUBLIC_KEY_LENGTH = 2048;
40  
41  	int EL_GAMAL_GROUP_LENGTH = 3072;
42  	int EL_GAMAL_KEY_LENGTH = 256;
43  
44  	int AUTHENTICATION_NONCE_LENGTH = 64;
45  
46  	String EL_GAMAL_CIPHERTEXT_OPENING_TAG = "ElGamalCiphertext";
47  	String EL_GAMAL_DECRYPTION_SHARE_OPENING_TAG = "elGamalDecryptionShare";
48  	String PET_COMMITMENT_OPENING_TAG = "petC";
49  	String PET_DECOMMITMENT_OPENING_TAG = "petD";
50  	String EL_GAMAL_PUBLIC_KEY_OPENING_TAG = "elGamalPublicKey";
51  	String PUBLIC_KEY_CIPHERTEXT_OPENING_TAG = "publicKeyCiphertext";
52  	String PRIVATE_KEY_OPENING_TAG = "privateKey";
53  	String PUBLIC_KEY_OPENING_TAG = "publicKey";
54  	String SHARED_KEY_OPENING_TAG = "sharedKey";
55  	String SHARED_KEY_CIPHERTEXT_OPENING_TAG = "sharedKeyCiphertext";
56  	String SIGNATURE_OPENING_TAG = "signature";
57  	String VOTE_CAPABILITY_OPENING_TAG = "voteCapability";
58  	String VOTE_CAPABILITY_SHARE_OPENING_TAG = "voteCapabilityShare";
59  
60  	Charset CHARSET = StandardCharsets.UTF_8;
61  }