serialization.proto 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright 2017 Google Inc.
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * https://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. syntax = "proto2";
  16. option optimize_for = LITE_RUNTIME;
  17. package rlwe;
  18. option go_package = "github.com/google/shell-encryption";
  19. // NTT Polynomial
  20. message SerializedNttPolynomial {
  21. // Coefficients of the polynomial
  22. optional bytes coeffs = 1;
  23. // Number of coefficients of the polynomial.
  24. optional int32 num_coeffs = 2;
  25. }
  26. // RLWE Ciphertext
  27. message SerializedSymmetricRlweCiphertext {
  28. // Polynomials composing the ciphertext
  29. repeated SerializedNttPolynomial c = 1;
  30. // The power of the secret key that the ciphertext is encrypted with.
  31. optional int32 power_of_s = 2;
  32. // A heuristic on the amount of error in the ciphertext.
  33. optional double error = 3;
  34. }
  35. // RLWE RelinearizationKey
  36. message SerializedRelinearizationKey {
  37. // Polynomial composing the matrix
  38. repeated SerializedNttPolynomial c = 1;
  39. // The modulus used to decompose the coefficients of the polynomials. Ranges
  40. // from 1 to the number of bits of the modulus.
  41. optional int32 log_decomposition_modulus = 2;
  42. // For n parts, the key can relinearize an n-component ciphertext to a
  43. // 2-component ciphertext.
  44. optional int32 num_parts = 3;
  45. // Seed used to compress this key.
  46. optional bytes prng_seed = 4; // Required
  47. // The power of s that corresponds to the key. The field is 1 if the key is
  48. // RelinearizationKey.
  49. optional int32 power_of_s = 5;
  50. }
  51. // RLWE GaloisKeys.
  52. message SerializedGaloisKey {
  53. // The key-switching matrix
  54. optional SerializedRelinearizationKey key = 1;
  55. }