Class NativeHEHelper
- java.lang.Object
- 
- org.apache.sysds.runtime.controlprogram.paramserv.NativeHEHelper
 
- 
 public class NativeHEHelper extends Object 
- 
- 
Constructor SummaryConstructors Constructor Description NativeHEHelper()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]accumulateCiphertexts(long server, byte[][] ciphertexts)accumulates the given ciphertexts into a sum ciphertext and returns itstatic byte[]aggregatePartialPublicKeys(long server, byte[][] partial_public_keys)accumulates the given partial public keys into a public key, stores it in server and returns itstatic double[]average(long server, byte[] encrypted_sum, byte[][] partial_plaintexts)averages the partial decryptions and returns the resultstatic byte[]encrypt(long client, double[] plaintexts)encrypts data with public key stored in client setPublicKey() must have been called before calling thisstatic byte[]generateA(long server)this generates the a constant.static byte[]generatePartialPublicKey(long client)generates a partial public key stores a partial private key corresponding to the partial public key in clientstatic longinitClient(byte[] a)generates a Client objectstatic booleaninitialize()static longinitServer()generates the Server object and returns a pointer to itstatic byte[]partiallyDecrypt(long client, byte[] ciphertext)partially decrypts ciphertexts with the partial private key.static voidsetPublicKey(long client, byte[] public_key)sets the public key and stores it in client
 
- 
- 
- 
Method Detail- 
initializepublic static boolean initialize() 
 - 
initClientpublic static long initClient(byte[] a) generates a Client object- Parameters:
- a- a constant generated by generateA
- Returns:
- a pointer to the native client object
 
 - 
generatePartialPublicKeypublic static byte[] generatePartialPublicKey(long client) generates a partial public key stores a partial private key corresponding to the partial public key in client- Parameters:
- client- A pointer to a Client, obtained from initClient
- Returns:
- a serialized partial public key
 
 - 
setPublicKeypublic static void setPublicKey(long client, byte[] public_key)sets the public key and stores it in client- Parameters:
- client- A pointer to a Client, obtained from initClient
- public_key- serialized public key obtained from generatePartialPublicKey
 
 - 
encryptpublic static byte[] encrypt(long client, double[] plaintexts)encrypts data with public key stored in client setPublicKey() must have been called before calling this- Parameters:
- client- A pointer to a Client, obtained from initClient
- plaintexts- array of double values to be encrypted
- Returns:
- serialized ciphertext
 
 - 
partiallyDecryptpublic static byte[] partiallyDecrypt(long client, byte[] ciphertext)partially decrypts ciphertexts with the partial private key. generatePartialPublicKey() must have been called before calling this function- Parameters:
- client- A pointer to a Client, obtained from initClient
- ciphertext- serialized ciphertext
- Returns:
- serialized partial decryption
 
 - 
initServerpublic static long initServer() generates the Server object and returns a pointer to it- Returns:
- pointer to a native Server object
 
 - 
generateApublic static byte[] generateA(long server) this generates the a constant. in a future version we want to generate this together with the clients to prevent misuse- Parameters:
- server- A pointer to a Server, obtained from initServer
- Returns:
- serialized a constant
 
 - 
aggregatePartialPublicKeyspublic static byte[] aggregatePartialPublicKeys(long server, byte[][] partial_public_keys)accumulates the given partial public keys into a public key, stores it in server and returns it- Parameters:
- server- A pointer to a Server, obtained from initServer
- partial_public_keys- array of serialized partial public keys
- Returns:
- serialized partial public key
 
 - 
accumulateCiphertextspublic static byte[] accumulateCiphertexts(long server, byte[][] ciphertexts)accumulates the given ciphertexts into a sum ciphertext and returns it- Parameters:
- server- A pointer to a Server, obtained from initServer
- ciphertexts- array of serialized ciphertexts
- Returns:
- serialized accumulated ciphertext
 
 - 
averagepublic static double[] average(long server, byte[] encrypted_sum, byte[][] partial_plaintexts)averages the partial decryptions and returns the result- Parameters:
- server- A pointer to a Server, obtained from initServer
- encrypted_sum- the result of accumulateCiphertexts()
- partial_plaintexts- the result of partiallyDecrypt of each ciphertext fed into accumulateCiphertexts
- Returns:
- average of original data
 
 
- 
 
-