IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Azure Key Vault

Open MatthewGabriel opened this issue 9 years ago • 8 comments

Hi,

Does anyone have any advice about using Azure Key Vault for storing asymmetric keys for use in IdentityServer? I can only find limited information about using certificates, but I'd rather use an RsaSecurityKey.

Thanks,

MatthewGabriel avatar May 11 '17 17:05 MatthewGabriel

You can store certs in keyvault as secrets (they are stored as Base64 encoded strings) then in your startup you can pull them down using keyvault rest api and read into X509Certificate2.

Mardoxx avatar May 12 '17 23:05 Mardoxx

certs aren't secrets, they are public. I think you mean keys. ..tom


From: Mardoxx [email protected] Sent: Friday, May 12, 2017 4:08 PM To: IdentityServer/IdentityServer4 Cc: Subscribed Subject: Re: [IdentityServer/IdentityServer4] Azure Key Vault (#1159)

You can store certs in keyvault as secrets (they are stored as Base64 encoded strings) then in your startup you can pull them down using keyvault rest api and read into X509Certificate2.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/IdentityServer/IdentityServer4/issues/1159#issuecomment-301205396, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKxq1mrvnGKQnbiF7XD7zQYEHJCLnVDrks5r5OaAgaJpZM4NYSXc.

TomCJones avatar May 12 '17 23:05 TomCJones

Yes

Mardoxx avatar May 12 '17 23:05 Mardoxx

I was specifically thinking keys, rather than certificates. Keys are stored in the keys section and certs in the secrets section and the private key never comes out of the vault (as I understand it). Furthermore, I want to take advantage of key rolling (versions) within the key vault, so the application needs to be able to see the new key when it changes. I'm going to be looking into it properly soon, so I will post any findings here when that happens, but just wondered if anyone had already done it.

MatthewGabriel avatar May 13 '17 11:05 MatthewGabriel

You can replace (or derive) from your default token creation service -

https://github.com/IdentityServer/IdentityServer4/blob/dev/src/IdentityServer4/Services/DefaultTokenCreationService.cs

and then use the KeyVault API to obtain a signature.

leastprivilege avatar May 13 '17 11:05 leastprivilege

Thank you @leastprivilege for pointing me in the right direction. I should get to look into this over the next week. And also thank you and @brockallen for IdentityServer4, amazing piece of work.

MatthewGabriel avatar May 13 '17 13:05 MatthewGabriel

be careful to mark the key as non-exportable if that's what you want

TomCJones avatar May 13 '17 18:05 TomCJones

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 14 '20 16:01 lock[bot]