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

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 621446837
  • Loading branch information
ise-crypto authored and copybara-github committed Apr 3, 2024
1 parent d7460c2 commit 6e5d0ea
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 24 deletions.
7 changes: 3 additions & 4 deletions cc/signature/ed25519_proto_serialization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ util::StatusOr<Ed25519PublicKey> ParsePublicKey(
google::crypto::tink::Ed25519PublicKey proto_key;
RestrictedData restricted_data = serialization.SerializedKeyProto();
// OSS proto library complains if input is not converted to a string.
if (!proto_key.ParseFromString(std::string(
restricted_data.GetSecret(InsecureSecretKeyAccess::Get())))) {
if (!proto_key.ParseFromString(
restricted_data.GetSecret(InsecureSecretKeyAccess::Get()))) {
return util::Status(absl::StatusCode::kInvalidArgument,
"Failed to parse Ed25519PublicKey proto");
}
Expand Down Expand Up @@ -183,8 +183,7 @@ util::StatusOr<Ed25519PrivateKey> ParsePrivateKey(
google::crypto::tink::Ed25519PrivateKey proto_key;
RestrictedData restricted_data = serialization.SerializedKeyProto();
// OSS proto library complains if input is not converted to a string.
if (!proto_key.ParseFromString(
std::string(restricted_data.GetSecret(*token)))) {
if (!proto_key.ParseFromString(restricted_data.GetSecret(*token))) {
return util::Status(absl::StatusCode::kInvalidArgument,
"Failed to parse Ed25519PrivateKey proto");
}
Expand Down
8 changes: 4 additions & 4 deletions cc/signature/ed25519_proto_serialization_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ TEST_P(Ed25519ProtoSerializationTest, SerializePublicKey) {

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

google::crypto::tink::Ed25519PrivateKey proto_key;
// OSS proto library complains if input is not converted to a string.
ASSERT_THAT(proto_key.ParseFromString(std::string(
ASSERT_THAT(proto_key.ParseFromString(
proto_serialization->SerializedKeyProto().GetSecret(
InsecureSecretKeyAccess::Get()))),
InsecureSecretKeyAccess::Get())),
IsTrue());
EXPECT_THAT(proto_key.version(), Eq(0));
EXPECT_THAT(proto_key.key_value(), Eq((*key_pair)->private_key));
Expand Down
7 changes: 3 additions & 4 deletions cc/signature/rsa_ssa_pkcs1_proto_serialization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ util::StatusOr<RsaSsaPkcs1PublicKey> ParsePublicKey(
google::crypto::tink::RsaSsaPkcs1PublicKey proto_key;
const RestrictedData& restricted_data = serialization.SerializedKeyProto();
// OSS proto library complains if input is not converted to a string.
if (!proto_key.ParseFromString(std::string(
restricted_data.GetSecret(InsecureSecretKeyAccess::Get())))) {
if (!proto_key.ParseFromString(
restricted_data.GetSecret(InsecureSecretKeyAccess::Get()))) {
return util::Status(absl::StatusCode::kInvalidArgument,
"Failed to parse RsaSsaPkcs1PublicKey proto");
}
Expand Down Expand Up @@ -239,8 +239,7 @@ util::StatusOr<RsaSsaPkcs1PrivateKey> ParsePrivateKey(
google::crypto::tink::RsaSsaPkcs1PrivateKey proto_key;
const RestrictedData& restricted_data = serialization.SerializedKeyProto();
// OSS proto library complains if input is not converted to a string.
if (!proto_key.ParseFromString(
std::string(restricted_data.GetSecret(*token)))) {
if (!proto_key.ParseFromString(restricted_data.GetSecret(*token))) {
return util::Status(absl::StatusCode::kInvalidArgument,
"Failed to parse RsaSsaPkcs1PrivateKey proto");
}
Expand Down
8 changes: 4 additions & 4 deletions cc/signature/rsa_ssa_pkcs1_proto_serialization_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ TEST_P(RsaSsaPkcs1ProtoSerializationTest, SerializePublicKeySucceeds) {

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

EXPECT_THAT(proto_key.version(), Eq(0));
Expand Down Expand Up @@ -731,9 +731,9 @@ TEST_P(RsaSsaPkcs1ProtoSerializationTest, SerializePrivateKeySucceeds) {

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

EXPECT_THAT(proto_key.version(), Eq(0));
Expand Down
7 changes: 3 additions & 4 deletions cc/signature/rsa_ssa_pss_proto_serialization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ util::StatusOr<RsaSsaPssPublicKey> ParsePublicKey(
google::crypto::tink::RsaSsaPssPublicKey proto_key;
RestrictedData restricted_data = serialization.SerializedKeyProto();
// OSS proto library complains if input is not converted to a string.
if (!proto_key.ParseFromString(std::string(
restricted_data.GetSecret(InsecureSecretKeyAccess::Get())))) {
if (!proto_key.ParseFromString(
restricted_data.GetSecret(InsecureSecretKeyAccess::Get()))) {
return util::Status(absl::StatusCode::kInvalidArgument,
"Failed to parse RsaSsaPssPublicKey proto");
}
Expand Down Expand Up @@ -267,8 +267,7 @@ util::StatusOr<RsaSsaPssPrivateKey> ParsePrivateKey(
google::crypto::tink::RsaSsaPssPrivateKey proto_key;
RestrictedData restricted_data = serialization.SerializedKeyProto();
// OSS proto library complains if input is not converted to a string.
if (!proto_key.ParseFromString(
std::string(restricted_data.GetSecret(*token)))) {
if (!proto_key.ParseFromString(restricted_data.GetSecret(*token))) {
return util::Status(absl::StatusCode::kInvalidArgument,
"Failed to parse RsaSsaPssPrivateKey proto");
}
Expand Down
8 changes: 4 additions & 4 deletions cc/signature/rsa_ssa_pss_proto_serialization_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@ TEST_P(RsaSsaPssProtoSerializationTest, SerializePublicKeySucceeds) {

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

EXPECT_THAT(proto_key.version(), Eq(0));
Expand Down Expand Up @@ -777,9 +777,9 @@ TEST_P(RsaSsaPssProtoSerializationTest, SerializePrivateKeySucceeds) {

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

EXPECT_THAT(proto_key.version(), Eq(0));
Expand Down

0 comments on commit 6e5d0ea

Please sign in to comment.