Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

feat: add support for Raw PKCS#1 signing keys #651

Merged
merged 2 commits into from Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -2943,7 +2943,7 @@ public final UnaryCallable<DecryptRequest, DecryptResponse> decryptCallable() {
*
* @param name Required. The resource name of the
* [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.
* @param digest Required. The digest of the data to sign. The digest must be produced with the
* @param digest Optional. The digest of the data to sign. The digest must be produced with the
* same digest algorithm as specified by the key version's
* [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
Expand Down Expand Up @@ -2980,7 +2980,7 @@ public final AsymmetricSignResponse asymmetricSign(CryptoKeyVersionName name, Di
*
* @param name Required. The resource name of the
* [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.
* @param digest Required. The digest of the data to sign. The digest must be produced with the
* @param digest Optional. The digest of the data to sign. The digest must be produced with the
* same digest algorithm as specified by the key version's
* [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
Expand Down Expand Up @@ -3015,6 +3015,8 @@ public final AsymmetricSignResponse asymmetricSign(String name, Digest digest) {
* .toString())
* .setDigest(Digest.newBuilder().build())
* .setDigestCrc32C(Int64Value.newBuilder().build())
* .setData(ByteString.EMPTY)
* .setDataCrc32C(Int64Value.newBuilder().build())
* .build();
* AsymmetricSignResponse response = keyManagementServiceClient.asymmetricSign(request);
* }
Expand Down Expand Up @@ -3051,6 +3053,8 @@ public final AsymmetricSignResponse asymmetricSign(AsymmetricSignRequest request
* .toString())
* .setDigest(Digest.newBuilder().build())
* .setDigestCrc32C(Int64Value.newBuilder().build())
* .setData(ByteString.EMPTY)
* .setDataCrc32C(Int64Value.newBuilder().build())
* .build();
* ApiFuture<AsymmetricSignResponse> future =
* keyManagementServiceClient.asymmetricSignCallable().futureCall(request);
Expand Down
Expand Up @@ -2077,6 +2077,7 @@ public void asymmetricSignTest() throws Exception {
.setSignatureCrc32C(Int64Value.newBuilder().build())
.setVerifiedDigestCrc32C(true)
.setName("name3373707")
.setVerifiedDataCrc32C(true)
.setProtectionLevel(ProtectionLevel.forNumber(0))
.build();
mockKeyManagementService.addResponse(expectedResponse);
Expand Down Expand Up @@ -2126,6 +2127,7 @@ public void asymmetricSignTest2() throws Exception {
.setSignatureCrc32C(Int64Value.newBuilder().build())
.setVerifiedDigestCrc32C(true)
.setName("name3373707")
.setVerifiedDataCrc32C(true)
.setProtectionLevel(ProtectionLevel.forNumber(0))
.build();
mockKeyManagementService.addResponse(expectedResponse);
Expand Down
Expand Up @@ -310,7 +310,7 @@ public final boolean isInitialized() {

@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
if (!getNameBytes().isEmpty()) {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
}
if (!ciphertext_.isEmpty()) {
Expand All @@ -328,7 +328,7 @@ public int getSerializedSize() {
if (size != -1) return size;

size = 0;
if (!getNameBytes().isEmpty()) {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
}
if (!ciphertext_.isEmpty()) {
Expand Down