Skip to content

Homomorphic Encryption

Homomorphic Encryption

OneCreation offers the ability to perform operations on homomorphically encrypted .csv files. This guide details how to use our API services to utilize this feature.

Keypair

The homomorphic encryption feature is supported on database and csv based datasets. Once you have created your dataset, you will need your datasourceId to generate a keypair for your data.

To do this send a POST request to /v1/dataset/keygen with "dataSetId" in the request body

Your dataSetId is the same as your datasourceId.

Once you have sent this request and received a succesful response, you now have a keypair for that dataset.

Encryption

To encrypt a .csv file, you will need to send a POST request to /v1/dataset/{datasetId}/encrypt-csv

The parameter for this request is your datasetId and the request body is a file attachment of the same .csv file you uploaded for your dataset.

Upon a succesful response of this request, you will receive a .henoc file attached in the response. This file will be used as your baseline for addition or subtraction operations

Addition

You can perform addition on numerical fields in a homomorphic encrypted file by sending a POST request to /v1/dataset/{dataSetId}/ops/add/{columnIndex}/{cellIndex}/{value}.

The parameters for this endpoint are:

  • dataSetId: Your dataSetId that you previously attained through the keypair endpoint
  • columnIndex: An integer value for which column you wish to preform an operation on. 0 is equal to column A in excel, 1 is equal to column B, 2 is equal to column C etc.
  • cellIndex: The index of the cell you wish to perform an operation on
  • value: The number you wish to add to the cell

The request body requires the file you downloaded from the encrypt-csv endpoint.

Upon a succesful response of this request you will receive a .henoc file which has the operations performend on the cells. To view the results you will need to decrypt the file by sending a POST request to /v1/dataset/{contributionId}/decrypt-csv.

Subtraction

You can perform subtraction on numerical fields in a homomorphic encrypted file by sending a POST request to /v1/dataset/{dataSetId}/ops/add/{columnIndex}/{cellIndex}/{value}.

The parameters for this endpoint are:

  • dataSetId: Your dataSetId that you previously attained through the keypair endpoint
  • columnIndex: An integer value for which column you wish to preform an operation on. 0 is equal to column A in excel, 1 is equal to column B, 2 is equal to column C etc.
  • cellIndex: The index of the cell you wish to perform an operation on
  • value: The number you wish to subtract from the cell

The request body requires the file you downloaded from the encrypt-csv endpoint.

Upon a succesful response of this request you will receive a .henoc file which has the operations performend on the cells. To view the results you will need to decrypt the csv file by sending a POST request to /v1/dataset/{contributionId}/decrypt-csv.

Decryption

To encrypt your .henoc file, you will need to send a POST request to /v1/dataset/{datasetId}/decryption-csv

The parameter for this request is your datasetId and the request body is the file attachment you received after a succesful response from either the add or subtract endpoint.

Upon a succesful response of this request, you will receive a .csv file attached in the response. You will be able to view the operations you performed on the cells in this file.


Last update: May 18, 2023