Class DGKPrivateKey
java.lang.Object
edu.fiu.adwise.homomorphic_encryption.dgk.DGKPrivateKey
- All Implemented Interfaces:
DGK_Key,Serializable,Key,PrivateKey,Destroyable
Represents a DGK (Damgård-Geisler-Krøigaard) private key used for homomorphic encryption.
This class implements the
Serializable, DGK_Key, and PrivateKey interfaces.
It contains both private and public key parameters, as well as methods for key serialization,
deserialization, and lookup table generation.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BigIntegerThe product of \( vp \) and \( vq \), used for decryption. -
Constructor Summary
ConstructorsConstructorDescriptionDGKPrivateKey(BigInteger p, BigInteger q, BigInteger vp, BigInteger vq, DGKPublicKey pubKey) Constructs a DGKPrivateKey using the provided private key parameters and public key. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this DGKPrivateKey with another object for equality.Returns the algorithm name.byte[]Returns the encoded form of the key.Returns the format of the key.intgetL()Returns the bit length of plaintext values.getN()Returns the modulus of the key.getU()Returns the upper bound for plaintext values.static DGKPrivateKeyDeserializes a DGK private key from a file.toString()Returns a string representation of the public key parameters.voidSerializes the private key to a file.Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javax.security.auth.Destroyable
destroy, isDestroyed
-
Field Details
-
v
The product of \( vp \) and \( vq \), used for decryption.
-
-
Constructor Details
-
DGKPrivateKey
Constructs a DGKPrivateKey using the provided private key parameters and public key.- Parameters:
p- First prime factor of nq- Second prime factor of nvp- Precomputed value for decryptionvq- Precomputed value for decryptionpubKey- Corresponding DGK public key
-
-
Method Details
-
writeKey
Serializes the private key to a file.- Parameters:
dgk_private_key_file- Path to the file where the private key will be saved- Throws:
IOException- If an I/O error occurs during serialization
-
readKey
public static DGKPrivateKey readKey(String dgk_private_key) throws IOException, ClassNotFoundException Deserializes a DGK private key from a file.- Parameters:
dgk_private_key- Path to the file containing the serialized private key- Returns:
- The deserialized DGKPrivateKey object
- Throws:
IOException- If an I/O error occurs during deserializationClassNotFoundException- If the class of the serialized object cannot be found
-
toString
Returns a string representation of the public key parameters. Private key parameters are excluded for security reasons. -
getU
Returns the upper bound for plaintext values. -
getN
Returns the modulus of the key. -
getL
public int getL()Returns the bit length of plaintext values. -
getAlgorithm
Returns the algorithm name.- Specified by:
getAlgorithmin interfaceKey- Returns:
- The algorithm name ("DGK")
-
getFormat
Returns the format of the key. -
getEncoded
public byte[] getEncoded()Returns the encoded form of the key. This implementation returns null as encoding is not supported.- Specified by:
getEncodedin interfaceKey- Returns:
- null
-
equals
Compares this DGKPrivateKey with another object for equality.
-