Skip to content

Commit f6795aa

Browse files
authored
Add OPRF proto messages (#18)
1 parent c257853 commit f6795aa

File tree

8 files changed

+64
-11
lines changed

8 files changed

+64
-11
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Ignore generated files
22
*.pb.swift
3+
4+
.DS_Store
35
.idea

.pre-commit-config.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ repos:
5252
- copyright-header.txt
5353
- --allow-past-years
5454
- --use-current-year
55+
- id: insert-license
56+
name: insert-license-sh
57+
files: \.sh$
58+
args:
59+
- --license-filepath
60+
- copyright-header.txt
61+
- --allow-past-years
62+
- --use-current-year
5563
- repo: https://github.com/bufbuild/buf
5664
rev: v1.48.0
5765
hooks:

apple/swift_homomorphic_encryption/api/pir/v1/api.proto

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Apple Inc. and the Swift Homomorphic Encryption project authors
1+
// Copyright 2024-2025 Apple Inc. and the Swift Homomorphic Encryption project authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -69,6 +69,8 @@ message Request {
6969
oneof request {
7070
// PIR request.
7171
apple.swift_homomorphic_encryption.api.pir.v1.PIRRequest pir_request = 2;
72+
// OPRF request.
73+
apple.swift_homomorphic_encryption.api.pir.v1.OPRFRequest oprf_request = 4;
7274
}
7375
reserved 3;
7476
}
@@ -79,6 +81,8 @@ message Response {
7981
oneof response {
8082
// Response to a `PIRRequest`.
8183
apple.swift_homomorphic_encryption.api.pir.v1.PIRResponse pir_response = 1;
84+
// Response to `OPRFRequest`.
85+
apple.swift_homomorphic_encryption.api.pir.v1.OPRFResponse oprf_response = 3;
8286
}
8387
reserved 2;
8488
}

apple/swift_homomorphic_encryption/api/pir/v1/pir.proto

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Apple Inc. and the Swift Homomorphic Encryption project authors
1+
// Copyright 2024-2025 Apple Inc. and the Swift Homomorphic Encryption project authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -93,3 +93,19 @@ message PIRResponse {
9393
// Encrypted replies, each of which is a ciphertext vector.
9494
repeated apple.swift_homomorphic_encryption.v1.SerializedCiphertextVec replies = 1;
9595
}
96+
97+
// PIR OPRF Request.
98+
message OPRFRequest {
99+
// Serialized query.
100+
bytes query_element = 1;
101+
// Identifier for PirConfig used to construct this request.
102+
bytes config_id = 2;
103+
}
104+
105+
// PIR OPRF Response.
106+
message OPRFResponse {
107+
// Serialized output of OPRF.
108+
bytes evaluated_element = 1;
109+
// Proof of OPRF evaluation.
110+
bytes proof = 2;
111+
}

apple/swift_homomorphic_encryption/api/pnns/v1/api.proto

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Apple Inc. and the Swift Homomorphic Encryption project authors
1+
// Copyright 2024-2025 Apple Inc. and the Swift Homomorphic Encryption project authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -71,6 +71,7 @@ message Request {
7171
// PNNS request.
7272
apple.swift_homomorphic_encryption.api.pnns.v1.PNNSRequest pnns_request = 3;
7373
}
74+
reserved 4;
7475
}
7576

7677
// Generic response.
@@ -81,4 +82,5 @@ message Response {
8182
// Response to a `PNNSRequest`.
8283
apple.swift_homomorphic_encryption.api.pnns.v1.PNNSResponse pnns_response = 2;
8384
}
85+
reserved 3;
8486
}

apple/swift_homomorphic_encryption/api/v1/api.proto

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Apple Inc. and the Swift Homomorphic Encryption project authors
1+
// Copyright 2024-2025 Apple Inc. and the Swift Homomorphic Encryption project authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -73,6 +73,8 @@ message Request {
7373
apple.swift_homomorphic_encryption.api.pir.v1.PIRRequest pir_request = 2;
7474
// PNNS request.
7575
apple.swift_homomorphic_encryption.api.pnns.v1.PNNSRequest pnns_request = 3;
76+
// OPRF request.
77+
apple.swift_homomorphic_encryption.api.pir.v1.OPRFRequest oprf_request = 4;
7678
}
7779
}
7880

@@ -84,5 +86,7 @@ message Response {
8486
apple.swift_homomorphic_encryption.api.pir.v1.PIRResponse pir_response = 1;
8587
// Response to a `PNNSRequest`.
8688
apple.swift_homomorphic_encryption.api.pnns.v1.PNNSResponse pnns_response = 2;
89+
// Response to `OPRFRequest`.
90+
apple.swift_homomorphic_encryption.api.pir.v1.OPRFResponse oprf_response = 3;
8791
}
8892
}

apple/swift_homomorphic_encryption/pir/v1/pir.proto

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Apple Inc. and the Swift Homomorphic Encryption project authors
1+
// Copyright 2024-2025 Apple Inc. and the Swift Homomorphic Encryption project authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -51,14 +51,16 @@ message PirParameters {
5151
apple.swift_homomorphic_encryption.v1.EvaluationKeyConfig evaluation_key_config = 8;
5252
// Key compression strategy.
5353
KeyCompressionStrategy key_compression_strategy = 9;
54-
reserved 10, 11;
54+
reserved 10, 11, 12;
5555
}
5656

5757
// Parameters for keyword PIR.
5858
message KeywordPirParameters {
5959
// The number of hash functions used.
6060
uint64 num_hash_functions = 1;
61-
reserved 2, 3;
61+
reserved 2;
62+
// Symmetric PIR configuration
63+
SymmetricPirClientConfig symmetric_pir_client_config = 3;
6264
// The sharding function to use.
6365
PIRShardingFunction sharding_function = 4;
6466
}
@@ -94,3 +96,19 @@ message EncryptedIndices {
9496
// Number of PIR calls.
9597
uint64 num_pir_calls = 2;
9698
}
99+
100+
// Scheme used for encrypting database entries in Symmetric PIR.
101+
enum SymmetricPirConfigType {
102+
// Unspecified config type.
103+
SYMMETRIC_PIR_CONFIG_TYPE_UNSPECIFIED = 0;
104+
// OPRF P384 AES-192-GCM, 96-bit nonce, 128-bit tag
105+
SYMMETRIC_PIR_CONFIG_TYPE_OPRF_P384_AES_GCM_192_NONCE_96_TAG_128 = 1;
106+
}
107+
108+
// Client specific PIR configuration for Symmetric PIR
109+
message SymmetricPirClientConfig {
110+
// Server public key
111+
bytes server_public_key = 1;
112+
// Symmetric PIR config type
113+
SymmetricPirConfigType config_type = 2;
114+
}

buf.yaml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 Apple Inc. and the Swift Homomorphic Encryption project authors
1+
# Copyright 2024-2025 Apple Inc. and the Swift Homomorphic Encryption project authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,15 +12,14 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
version: v1
15+
version: v2
1616
breaking:
1717
use:
1818
- FILE
1919
- WIRE
20-
2120
lint:
2221
use:
23-
- DEFAULT
22+
- STANDARD
2423
- COMMENTS
2524
- PACKAGE_NO_IMPORT_CYCLE
2625
ignore_only:

0 commit comments

Comments
 (0)