Skip to content
This repository was archived by the owner on Apr 17, 2024. It is now read-only.

Commit 6e5d0ea

Browse files
ise-cryptocopybara-github
authored andcommitted
Automated Code Change
PiperOrigin-RevId: 621446837
1 parent d7460c2 commit 6e5d0ea

6 files changed

+21
-24
lines changed

cc/signature/ed25519_proto_serialization.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ util::StatusOr<Ed25519PublicKey> ParsePublicKey(
142142
google::crypto::tink::Ed25519PublicKey proto_key;
143143
RestrictedData restricted_data = serialization.SerializedKeyProto();
144144
// OSS proto library complains if input is not converted to a string.
145-
if (!proto_key.ParseFromString(std::string(
146-
restricted_data.GetSecret(InsecureSecretKeyAccess::Get())))) {
145+
if (!proto_key.ParseFromString(
146+
restricted_data.GetSecret(InsecureSecretKeyAccess::Get()))) {
147147
return util::Status(absl::StatusCode::kInvalidArgument,
148148
"Failed to parse Ed25519PublicKey proto");
149149
}
@@ -183,8 +183,7 @@ util::StatusOr<Ed25519PrivateKey> ParsePrivateKey(
183183
google::crypto::tink::Ed25519PrivateKey proto_key;
184184
RestrictedData restricted_data = serialization.SerializedKeyProto();
185185
// OSS proto library complains if input is not converted to a string.
186-
if (!proto_key.ParseFromString(
187-
std::string(restricted_data.GetSecret(*token)))) {
186+
if (!proto_key.ParseFromString(restricted_data.GetSecret(*token))) {
188187
return util::Status(absl::StatusCode::kInvalidArgument,
189188
"Failed to parse Ed25519PrivateKey proto");
190189
}

cc/signature/ed25519_proto_serialization_test.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ TEST_P(Ed25519ProtoSerializationTest, SerializePublicKey) {
315315

316316
google::crypto::tink::Ed25519PublicKey proto_key;
317317
// OSS proto library complains if input is not converted to a string.
318-
ASSERT_THAT(proto_key.ParseFromString(std::string(
318+
ASSERT_THAT(proto_key.ParseFromString(
319319
proto_serialization->SerializedKeyProto().GetSecret(
320-
InsecureSecretKeyAccess::Get()))),
320+
InsecureSecretKeyAccess::Get())),
321321
IsTrue());
322322
EXPECT_THAT(proto_key.version(), Eq(0));
323323
EXPECT_THAT(proto_key.key_value(), Eq(raw_key_bytes));
@@ -505,9 +505,9 @@ TEST_P(Ed25519ProtoSerializationTest, SerializePrivateKey) {
505505

506506
google::crypto::tink::Ed25519PrivateKey proto_key;
507507
// OSS proto library complains if input is not converted to a string.
508-
ASSERT_THAT(proto_key.ParseFromString(std::string(
508+
ASSERT_THAT(proto_key.ParseFromString(
509509
proto_serialization->SerializedKeyProto().GetSecret(
510-
InsecureSecretKeyAccess::Get()))),
510+
InsecureSecretKeyAccess::Get())),
511511
IsTrue());
512512
EXPECT_THAT(proto_key.version(), Eq(0));
513513
EXPECT_THAT(proto_key.key_value(), Eq((*key_pair)->private_key));

cc/signature/rsa_ssa_pkcs1_proto_serialization.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ util::StatusOr<RsaSsaPkcs1PublicKey> ParsePublicKey(
201201
google::crypto::tink::RsaSsaPkcs1PublicKey proto_key;
202202
const RestrictedData& restricted_data = serialization.SerializedKeyProto();
203203
// OSS proto library complains if input is not converted to a string.
204-
if (!proto_key.ParseFromString(std::string(
205-
restricted_data.GetSecret(InsecureSecretKeyAccess::Get())))) {
204+
if (!proto_key.ParseFromString(
205+
restricted_data.GetSecret(InsecureSecretKeyAccess::Get()))) {
206206
return util::Status(absl::StatusCode::kInvalidArgument,
207207
"Failed to parse RsaSsaPkcs1PublicKey proto");
208208
}
@@ -239,8 +239,7 @@ util::StatusOr<RsaSsaPkcs1PrivateKey> ParsePrivateKey(
239239
google::crypto::tink::RsaSsaPkcs1PrivateKey proto_key;
240240
const RestrictedData& restricted_data = serialization.SerializedKeyProto();
241241
// OSS proto library complains if input is not converted to a string.
242-
if (!proto_key.ParseFromString(
243-
std::string(restricted_data.GetSecret(*token)))) {
242+
if (!proto_key.ParseFromString(restricted_data.GetSecret(*token))) {
244243
return util::Status(absl::StatusCode::kInvalidArgument,
245244
"Failed to parse RsaSsaPkcs1PrivateKey proto");
246245
}

cc/signature/rsa_ssa_pkcs1_proto_serialization_test.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,9 @@ TEST_P(RsaSsaPkcs1ProtoSerializationTest, SerializePublicKeySucceeds) {
482482

483483
google::crypto::tink::RsaSsaPkcs1PublicKey proto_key;
484484
// OSS proto library complains if input is not converted to a string.
485-
ASSERT_THAT(proto_key.ParseFromString(std::string(
485+
ASSERT_THAT(proto_key.ParseFromString(
486486
proto_serialization->SerializedKeyProto().GetSecret(
487-
InsecureSecretKeyAccess::Get()))),
487+
InsecureSecretKeyAccess::Get())),
488488
IsTrue());
489489

490490
EXPECT_THAT(proto_key.version(), Eq(0));
@@ -731,9 +731,9 @@ TEST_P(RsaSsaPkcs1ProtoSerializationTest, SerializePrivateKeySucceeds) {
731731

732732
google::crypto::tink::RsaSsaPkcs1PrivateKey proto_key;
733733
// OSS proto library complains if input is not converted to a string.
734-
ASSERT_THAT(proto_key.ParseFromString(std::string(
734+
ASSERT_THAT(proto_key.ParseFromString(
735735
proto_serialization->SerializedKeyProto().GetSecret(
736-
InsecureSecretKeyAccess::Get()))),
736+
InsecureSecretKeyAccess::Get())),
737737
IsTrue());
738738

739739
EXPECT_THAT(proto_key.version(), Eq(0));

cc/signature/rsa_ssa_pss_proto_serialization.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ util::StatusOr<RsaSsaPssPublicKey> ParsePublicKey(
229229
google::crypto::tink::RsaSsaPssPublicKey proto_key;
230230
RestrictedData restricted_data = serialization.SerializedKeyProto();
231231
// OSS proto library complains if input is not converted to a string.
232-
if (!proto_key.ParseFromString(std::string(
233-
restricted_data.GetSecret(InsecureSecretKeyAccess::Get())))) {
232+
if (!proto_key.ParseFromString(
233+
restricted_data.GetSecret(InsecureSecretKeyAccess::Get()))) {
234234
return util::Status(absl::StatusCode::kInvalidArgument,
235235
"Failed to parse RsaSsaPssPublicKey proto");
236236
}
@@ -267,8 +267,7 @@ util::StatusOr<RsaSsaPssPrivateKey> ParsePrivateKey(
267267
google::crypto::tink::RsaSsaPssPrivateKey proto_key;
268268
RestrictedData restricted_data = serialization.SerializedKeyProto();
269269
// OSS proto library complains if input is not converted to a string.
270-
if (!proto_key.ParseFromString(
271-
std::string(restricted_data.GetSecret(*token)))) {
270+
if (!proto_key.ParseFromString(restricted_data.GetSecret(*token))) {
272271
return util::Status(absl::StatusCode::kInvalidArgument,
273272
"Failed to parse RsaSsaPssPrivateKey proto");
274273
}

cc/signature/rsa_ssa_pss_proto_serialization_test.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,9 @@ TEST_P(RsaSsaPssProtoSerializationTest, SerializePublicKeySucceeds) {
517517

518518
google::crypto::tink::RsaSsaPssPublicKey proto_key;
519519
// OSS proto library complains if input is not converted to a string.
520-
ASSERT_THAT(proto_key.ParseFromString(std::string(
520+
ASSERT_THAT(proto_key.ParseFromString(
521521
proto_serialization->SerializedKeyProto().GetSecret(
522-
InsecureSecretKeyAccess::Get()))),
522+
InsecureSecretKeyAccess::Get())),
523523
IsTrue());
524524

525525
EXPECT_THAT(proto_key.version(), Eq(0));
@@ -777,9 +777,9 @@ TEST_P(RsaSsaPssProtoSerializationTest, SerializePrivateKeySucceeds) {
777777

778778
google::crypto::tink::RsaSsaPssPrivateKey proto_key;
779779
// OSS proto library complains if input is not converted to a string.
780-
ASSERT_THAT(proto_key.ParseFromString(std::string(
780+
ASSERT_THAT(proto_key.ParseFromString(
781781
proto_serialization->SerializedKeyProto().GetSecret(
782-
InsecureSecretKeyAccess::Get()))),
782+
InsecureSecretKeyAccess::Get())),
783783
IsTrue());
784784

785785
EXPECT_THAT(proto_key.version(), Eq(0));

0 commit comments

Comments
 (0)