Я создал проект GCP с криптографическими ключами в KMS. Сейчас я пытаюсь зашифровать данные с помощью ключа от KMS.
public static void Encrypt(string projectId, string locationId, string keyRingId, string cryptoKeyId,string plaintextFile, string ciphertextFile)
{
KeyManagementServiceClient client = KeyManagementServiceClient.Create();
CryptoKeyName cryptoKeyName =
new CryptoKeyName(projectId, locationId, keyRingId, cryptoKeyId);
byte[] plaintext = File.ReadAllBytes(plaintextFile);
CryptoKeyPathName pathName = CryptoKeyPathName.Parse(cryptoKeyName.ToString());
EncryptResponse result = client.Encrypt(pathName, ByteString.CopyFrom(plaintext));
// Output encrypted data to a file.
File.WriteAllBytes(ciphertextFile, result.Ciphertext.ToByteArray());
Console.Write($"Encrypted file created: {ciphertextFile}");
}
пример кода из Google Cloud . Когда я пытаюсь запустить это, я получаю:
`"Status(StatusCode=Unavailable, Detail=\"Connect Failed\")"` from grpc.core (`Exception thrown: 'Grpc.Core.RpcException' in mscorlib.dll`).
Кто-нибудь сталкивался с подобной проблемой? или есть идеи в чем может быть причина?