aboutsummaryrefslogtreecommitdiff
path: root/java_src/src/test/java/com/google/crypto/tink/hybrid/internal/HpkeContextTest.java
diff options
context:
space:
mode:
authorwconner <wconner@google.com>2022-06-01 06:41:10 -0700
committerCopybara-Service <copybara-worker@google.com>2022-06-01 06:42:25 -0700
commit8e723a65613fad046071e2c31c3aed0f22f844fb (patch)
tree548bcf21a25fbe6972ec9f00f151e4cb657f891f /java_src/src/test/java/com/google/crypto/tink/hybrid/internal/HpkeContextTest.java
parent37fa26db494efe6b24607e1938870dfbbabc142e (diff)
downloadtink-8e723a65613fad046071e2c31c3aed0f22f844fb.tar.gz
Use shared test vectors for HPKE Java tests.
PiperOrigin-RevId: 452284001
Diffstat (limited to 'java_src/src/test/java/com/google/crypto/tink/hybrid/internal/HpkeContextTest.java')
-rw-r--r--java_src/src/test/java/com/google/crypto/tink/hybrid/internal/HpkeContextTest.java17
1 files changed, 3 insertions, 14 deletions
diff --git a/java_src/src/test/java/com/google/crypto/tink/hybrid/internal/HpkeContextTest.java b/java_src/src/test/java/com/google/crypto/tink/hybrid/internal/HpkeContextTest.java
index 564a2fbf4..1ba960a66 100644
--- a/java_src/src/test/java/com/google/crypto/tink/hybrid/internal/HpkeContextTest.java
+++ b/java_src/src/test/java/com/google/crypto/tink/hybrid/internal/HpkeContextTest.java
@@ -19,7 +19,6 @@ package com.google.crypto.tink.hybrid.internal;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.io.Files;
-import com.google.common.io.Resources;
import com.google.common.truth.Expect;
import com.google.crypto.tink.proto.HpkePrivateKey;
import com.google.crypto.tink.proto.HpkePublicKey;
@@ -31,7 +30,6 @@ import com.google.crypto.tink.testing.HpkeTestUtil;
import com.google.crypto.tink.testing.HpkeTestVector;
import com.google.crypto.tink.testing.TestUtil;
import com.google.protobuf.ByteString;
-import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.security.GeneralSecurityException;
@@ -51,20 +49,11 @@ public final class HpkeContextTest {
@BeforeClass
public static void setUpTestVectors() throws IOException {
- BufferedReader reader = null;
+ String path = "testdata/testvectors/hpke_boringssl.json";
if (TestUtil.isAndroid()) {
- reader =
- Files.newReader(
- new File(
- "/sdcard/googletest/test_runfiles/google3/" // Special prefix for Android.
- + "third_party/tink/java_src/src/test/java/com/google/crypto/tink/"
- + "hybrid/internal/testdata/test_vectors.json"),
- UTF_8);
- } else {
- String path = "com/google/crypto/tink/hybrid/internal/testdata/test_vectors.json";
- reader = Resources.asCharSource(Resources.getResource(path), UTF_8).openBufferedStream();
+ path = "/sdcard/googletest/test_runfiles/google3/" + path; // Special prefix for Android.
}
- testVectors = HpkeTestUtil.parseTestVectors(reader);
+ testVectors = HpkeTestUtil.parseTestVectors(Files.newReader(new File(path), UTF_8));
}
private HpkeTestVector getTestVector(byte[] mode, byte[] kemId, byte[] kdfId, byte[] aeadId) {