From f1bfb3af557e4cf99fed4a1285d252212aa09845 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Fri, 29 Jan 2021 11:09:23 -0800 Subject: [PATCH] Enable testing of public_exponent against MHSM (#18283) Resolves #16789 --- .../tests/ManagedHsmLiveTests.cs | 1 - .../CreateRsaWithPublicExponent.json | 98 +++++++++++++++++++ .../CreateRsaWithPublicExponentAsync.json | 98 +++++++++++++++++++ 3 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Keys/tests/SessionRecords/ManagedHsmLiveTests/CreateRsaWithPublicExponent.json create mode 100644 sdk/keyvault/Azure.Security.KeyVault.Keys/tests/SessionRecords/ManagedHsmLiveTests/CreateRsaWithPublicExponentAsync.json diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/ManagedHsmLiveTests.cs b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/ManagedHsmLiveTests.cs index cf5b1572bda7f..8395bdda1fbc1 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/ManagedHsmLiveTests.cs +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/ManagedHsmLiveTests.cs @@ -25,7 +25,6 @@ public ManagedHsmLiveTests(bool isAsync, KeyClientOptions.ServiceVersion service : throw new IgnoreException($"Required variable 'AZURE_MANAGEDHSM_URL' is not defined"); [Test] - [Ignore("Service issue: https://github.com/Azure/azure-sdk-for-net/issues/16789")] public async Task CreateRsaWithPublicExponent() { CreateRsaKeyOptions options = new CreateRsaKeyOptions(Recording.GenerateId()) diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/SessionRecords/ManagedHsmLiveTests/CreateRsaWithPublicExponent.json b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/SessionRecords/ManagedHsmLiveTests/CreateRsaWithPublicExponent.json new file mode 100644 index 0000000000000..ddcbb4875b184 --- /dev/null +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/SessionRecords/ManagedHsmLiveTests/CreateRsaWithPublicExponent.json @@ -0,0 +1,98 @@ +{ + "Entries": [ + { + "RequestUri": "https://heathskeyvaulthsm.managedhsm.azure.net/keys/896215099/create?api-version=7.1", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Type": "application/json", + "traceparent": "00-259b68009277b343977cbcae3d134803-1cbad51e3a162041-00", + "User-Agent": [ + "azsdk-net-Security.KeyVault.Keys/4.2.0-alpha.20210129.1", + "(.NET Core 4.6.29518.01; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "9854b6d0b298b90b5225581d3839464e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 401, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "0", + "Content-Security-Policy": "default-src \u0027self\u0027", + "Content-Type": "application/json; charset=utf-8", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "WWW-Authenticate": "Bearer authorization=\u0022https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47\u0022, resource=\u0022https://managedhsm.azure.net\u0022", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "x-ms-request-id": "fe0d9cbc-625a-11eb-a2af-0242ac12000a", + "x-ms-server-latency": "1" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://heathskeyvaulthsm.managedhsm.azure.net/keys/896215099/create?api-version=7.1", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "49", + "Content-Type": "application/json", + "traceparent": "00-259b68009277b343977cbcae3d134803-1cbad51e3a162041-00", + "User-Agent": [ + "azsdk-net-Security.KeyVault.Keys/4.2.0-alpha.20210129.1", + "(.NET Core 4.6.29518.01; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "9854b6d0b298b90b5225581d3839464e", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "kty": "RSA", + "key_size": 2048, + "public_exponent": 3 + }, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "708", + "Content-Security-Policy": "default-src \u0027self\u0027", + "Content-Type": "application/json; charset=utf-8", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "x-ms-keyvault-network-info": "addr=67.171.12.239", + "x-ms-keyvault-region": "eastus2", + "x-ms-request-id": "fe798026-625a-11eb-a2af-0242ac12000a", + "x-ms-server-latency": "1642" + }, + "ResponseBody": { + "attributes": { + "created": 1611942852, + "enabled": true, + "exportable": false, + "recoverableDays": 90, + "recoveryLevel": "Recoverable\u002BPurgeable", + "updated": 1611942852 + }, + "key": { + "e": "Aw", + "key_ops": [ + "wrapKey", + "decrypt", + "encrypt", + "unwrapKey", + "sign", + "verify" + ], + "kid": "https://heathskeyvaulthsm.managedhsm.azure.net/keys/896215099/fb366dda500f0efba89f1dd0835d1d67", + "kty": "RSA-HSM", + "n": "iw0gn9poPqHSKB1cIX-XtiieU02SwJJi0tn0f7Or8zKFEs2mL0fyeI77bW2pXPe9sCB09uFkKeMJLXGxXyur2JUcql0rVeVpoMqq3a-NpXAFNfZRuGmDV9kyCS3G2i0dWtjAbgjkClk5pc3VTKl9uhqyLn_qS5ypl1C96J-CmypBv361s30HmewLDdQhcpzORv_Fw6PSo4ZQapZhntFOrQdn7I8veJV1mXE7eq2gIkPQwiXnSbhkUwKdDUX8wlQ0cgFCY3ByAVIoHrzTpP3oW-Wm1lWfr1oTEUpSlhdreuIsHfjPUW95NjQ99-l2SDbAsWvNHWRgl8rC_a5pBmKShw" + } + } + } + ], + "Variables": { + "AZURE_MANAGEDHSM_URL": "https://heathskeyvaulthsm.managedhsm.azure.net/", + "RandomSeed": "1646831272" + } +} \ No newline at end of file diff --git a/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/SessionRecords/ManagedHsmLiveTests/CreateRsaWithPublicExponentAsync.json b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/SessionRecords/ManagedHsmLiveTests/CreateRsaWithPublicExponentAsync.json new file mode 100644 index 0000000000000..fa5f2079dc150 --- /dev/null +++ b/sdk/keyvault/Azure.Security.KeyVault.Keys/tests/SessionRecords/ManagedHsmLiveTests/CreateRsaWithPublicExponentAsync.json @@ -0,0 +1,98 @@ +{ + "Entries": [ + { + "RequestUri": "https://heathskeyvaulthsm.managedhsm.azure.net/keys/656549195/create?api-version=7.1", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Content-Type": "application/json", + "traceparent": "00-3537ccdfdbbbf2469f236a250a839c29-231587fe72fe2546-00", + "User-Agent": [ + "azsdk-net-Security.KeyVault.Keys/4.2.0-alpha.20210129.1", + "(.NET Core 4.6.29518.01; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "95ceb09cd391c180d7aea4cf5587e773", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": null, + "StatusCode": 401, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "0", + "Content-Security-Policy": "default-src \u0027self\u0027", + "Content-Type": "application/json; charset=utf-8", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "WWW-Authenticate": "Bearer authorization=\u0022https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47\u0022, resource=\u0022https://managedhsm.azure.net\u0022", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "x-ms-request-id": "00f9c1e4-625b-11eb-a2af-0242ac12000a", + "x-ms-server-latency": "1" + }, + "ResponseBody": [] + }, + { + "RequestUri": "https://heathskeyvaulthsm.managedhsm.azure.net/keys/656549195/create?api-version=7.1", + "RequestMethod": "POST", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "Sanitized", + "Content-Length": "49", + "Content-Type": "application/json", + "traceparent": "00-3537ccdfdbbbf2469f236a250a839c29-231587fe72fe2546-00", + "User-Agent": [ + "azsdk-net-Security.KeyVault.Keys/4.2.0-alpha.20210129.1", + "(.NET Core 4.6.29518.01; Microsoft Windows 10.0.19042 )" + ], + "x-ms-client-request-id": "95ceb09cd391c180d7aea4cf5587e773", + "x-ms-return-client-request-id": "true" + }, + "RequestBody": { + "kty": "RSA", + "key_size": 2048, + "public_exponent": 3 + }, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "708", + "Content-Security-Policy": "default-src \u0027self\u0027", + "Content-Type": "application/json; charset=utf-8", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "X-Frame-Options": "SAMEORIGIN", + "x-ms-keyvault-network-info": "addr=67.171.12.239", + "x-ms-keyvault-region": "eastus2", + "x-ms-request-id": "0136f91a-625b-11eb-a2af-0242ac12000a", + "x-ms-server-latency": "1243" + }, + "ResponseBody": { + "attributes": { + "created": 1611942856, + "enabled": true, + "exportable": false, + "recoverableDays": 90, + "recoveryLevel": "Recoverable\u002BPurgeable", + "updated": 1611942856 + }, + "key": { + "e": "Aw", + "key_ops": [ + "wrapKey", + "decrypt", + "encrypt", + "unwrapKey", + "sign", + "verify" + ], + "kid": "https://heathskeyvaulthsm.managedhsm.azure.net/keys/656549195/680417c772ee4e80999c3e72c0b11ad2", + "kty": "RSA-HSM", + "n": "rif1IQcHPpGyveHngSN2fUQkzNMY99vgrJVNRDiv6gcumv4_NLokENwxxmvWgs3OioYkO33LqMznMWj8P7ykkRzwlBaJk0dN-erZh62jO5kkwvqNbB-PbLtjGCe1lyqoJ4NH3sdadwblgpHleEZ93RyqrR8ootBmHgy3l8PdmtRfRRjrvdEaL8WZabo4ykZlCQWiP1gAX7tcHvb9RznrkRxJqiRdtS55vs-dQD3is8tmSiLyjrMeN7mcB9vi7dN23wopgaU9JMLFMl6XslfJql2pSOxmCSq16lu4tHsHcw94QTfkdJ-RwrCGJCKVfgdRa5LYA-vcp4GDTy8OH8gQOQ" + } + } + } + ], + "Variables": { + "AZURE_MANAGEDHSM_URL": "https://heathskeyvaulthsm.managedhsm.azure.net/", + "RandomSeed": "1265763897" + } +} \ No newline at end of file