OpenVector
  • OpenVector
  • Introduction
    • Our Thesis
    • Our Solution
    • Other Approaches
    • Benchmarks
  • Network Architecture
    • Overview
    • Networking
    • Deploy Compute Node
    • Deploy CoFHE Node
    • Deploy Client Node
  • Quick start
    • Overview
    • Setting up Client Node
    • Encrypting Data
    • Tensor Multiplication
    • Decrypting the Ouput
    • Verifying the Output
    • Running the Program
  • Tutorials
    • Building MLP Block
  • Use Cases
    • Confidential LLM Inference
    • Training on Encrypted Data
    • Vector Search on Encrypted Data
    • Encrypted Data Access Control
  • API references
    • CryptoSystem Interface
    • ClientNode Class
    • ComputeRequest Class
    • ComputeResponse Class
  • PYTHON API REFERENCES
    • Overview
    • Tensor
    • nn.Module
    • nn.Functional
  • Contribution
    • Call for Research
    • CoFHE Library
Powered by GitBook
On this page
  1. Quick start

Decrypting the Ouput

In this article we continue our quick start series. We assume that you are following from the previous article.

7. Create a Compute Request for Decryption

Since the result is still encrypted, we need to decrypt it.

    // Create an operand for the encrypted result
    ComputeRequest::ComputeOperationOperand decrypt_operand(
        ComputeRequest::DataType::TENSOR,
        ComputeRequest::DataEncrytionType::CIPHERTEXT,
        res->data()
    );

    // Define the decryption operation instance
    ComputeRequest::ComputeOperationInstance decrypt_operation(
        ComputeRequest::ComputeOperationType::UNARY,
        ComputeRequest::ComputeOperation::DECRYPT,
        { decrypt_operand }
    );

    // Create the compute request for decryption
    ComputeRequest req_d(decrypt_operation);

    // Perform the decryption
    client_node.compute(req_d, &res);

    // Measure the end time of decryption
    auto stop_d = std::chrono::high_resolution_clock::now();

    // Check if decryption was successful
    if (res && res->status() == ComputeResponse::Status::OK) {
        std::cout << "Decrypted result tensor received." << std::endl;
    } else {
        std::cerr << "Decryption failed." << std::endl;
        return 1;
    }

Explanation:

  • We create a ComputeOperationOperand with the encrypted result data.

  • We define a ComputeOperationInstance for the DECRYPT operation.

  • The compute method is called again to perform the decryption.

  • We measure the time taken for decryption.

PreviousTensor MultiplicationNextVerifying the Output

Last updated 6 months ago