Skip to content

Commit 62e27ed

Browse files
juergwcopybara-github
authored andcommitted
Add cross-language tests with KMS Envelope AEAD with Tink prefix.
In tink-crypto/tink-go#10 it was mentioned that KMS Envelope Keys can and are used with a TINK prefix. Add this test to make sure that all languages that currently support this are consistent. At the moment it does not work in Java. PiperOrigin-RevId: 615699070 Change-Id: I0ecdb1e356688db6c06a760a42104aee5934ee16
1 parent 34e8c67 commit 62e27ed

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

cross_language/cross_language/BUILD.bazel

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ py_test(
9090
requirement("absl-py"),
9191
"@tink_py//tink:tink_python",
9292
"@tink_py//tink/aead",
93+
"@tink_py//tink/proto:kms_envelope_py_pb2",
9394
"@tink_py//tink/proto:tink_py_pb2",
9495
"@tink_py//tink/testing:keyset_builder",
9596
],
@@ -315,8 +316,8 @@ py_library(
315316
name = "test_key",
316317
srcs = ["test_key.py"],
317318
deps = [
318-
"@tink_py//tink/proto:tink_py_pb2",
319319
"//cross_language/tink_config",
320+
"@tink_py//tink/proto:tink_py_pb2",
320321
],
321322
)
322323

cross_language/cross_language/aead_test.py

+15
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import tink
2525
from tink import aead
2626

27+
from tink.proto import kms_envelope_pb2
2728
from tink.proto import tink_pb2
2829
from tink.testing import keyset_builder
2930
from cross_language import tink_config
@@ -123,6 +124,20 @@ def tearDownModule():
123124
),
124125
utilities.SUPPORTED_LANGUAGES_BY_TEMPLATE_NAME['XCHACHA20_POLY1305'],
125126
),
127+
'_FAKE_KMS_ENVELOPE_AEAD_WITH_AES128_GCM_WITH_TINK_PREFIX': (
128+
tink_pb2.KeyTemplate(
129+
value=kms_envelope_pb2.KmsEnvelopeAeadKeyFormat(
130+
kek_uri=_FAKE_KMS_KEY_URI,
131+
dek_template=aead.aead_key_templates.AES128_GCM,
132+
).SerializeToString(),
133+
type_url=(
134+
'type.googleapis.com/google.crypto.tink.KmsEnvelopeAeadKey'
135+
),
136+
output_prefix_type=tink_pb2.TINK,
137+
),
138+
# TODO(b/329404375): This currently fails in Java.
139+
['cc', 'go', 'python'],
140+
),
126141
}
127142

128143

0 commit comments

Comments
 (0)