IdentityStream.HttpMessageSigning.ServiceModel
3.2.1
Prefix Reserved
dotnet add package IdentityStream.HttpMessageSigning.ServiceModel --version 3.2.1
NuGet\Install-Package IdentityStream.HttpMessageSigning.ServiceModel -Version 3.2.1
<PackageReference Include="IdentityStream.HttpMessageSigning.ServiceModel" Version="3.2.1" />
paket add IdentityStream.HttpMessageSigning.ServiceModel --version 3.2.1
#r "nuget: IdentityStream.HttpMessageSigning.ServiceModel, 3.2.1"
// Install IdentityStream.HttpMessageSigning.ServiceModel as a Cake Addin #addin nuget:?package=IdentityStream.HttpMessageSigning.ServiceModel&version=3.2.1 // Install IdentityStream.HttpMessageSigning.ServiceModel as a Cake Tool #tool nuget:?package=IdentityStream.HttpMessageSigning.ServiceModel&version=3.2.1
HttpMessageSigning
A .NET implementation of "Signing HTTP Messages" (Cavage, draft 12) for WCF and HttpClient.
Usage
When hooking up HTTP message signing, there's a bunch of configuration options available:
Option | Default | Description |
---|---|---|
AddRecommendedHeaders |
true |
Automatically adds recommended headers, such as (request-target) , (created) , (expires) , Date and Digest to HeadersToInclude based on the specification and configuration. |
DigestAlgorithm |
None | If set, enables digest calculation of the request body. If AddRecommendedHeaders has been turned off, you also have to add Digest to HeadersToInclude in order to enable the digest calculation. |
GetCurrentTimestamp |
DateTimeOffset.UtcNow |
Gets the current UTC timestamp. Useful for testing. |
HeadersToInclude |
Empty | A set of headers to include in the signature. |
Expires |
None | If set, enables signature expiry after the specified amount of time. |
AddHeaderValue |
N/A | Adds a header with a value to all signed requests and their signatures. |
AddHeaderValues |
N/A | Adds a collection of headers to all signed requests and their signatures. |
RequestTargetUriFormat |
UriFormat.Unescaped |
Gets or sets the URI format used when constructing the (request-target) header. |
When using a certificate for signing, there's a convenience method called HttpMessageSigningConfiguration.FromCertificate
that can be used to get a configuration with crypto settings based on the certificate.
WCF
To use HTTP message signing with WCF, call UseHttpMessageSigning
on your client:
<a id='snippet-wcf_endpoint_usehttpmessagesigning'></a>
var signatureAlgorithm = SignatureAlgorithm.Create(rsaOrECDsaAlgorithm);
var config = new HttpMessageSigningConfiguration("key-id", signatureAlgorithm);
using var client = new TheEndpointClient(binding, endpointAddress);
client.UseHttpMessageSigning(config);
// Make calls using client :)
<sup><a href='/test/IdentityStream.HttpMessageSigning.Tests/Snippets.cs#L16-L26' title='Snippet source file'>snippet source</a> | <a href='#snippet-wcf_endpoint_usehttpmessagesigning' title='Start of snippet'>anchor</a></sup>
HttpClient
To use HTTP message signing with HttpClient
, create an instance of SigningHttpMessageHandler
and pass it when creating the HttpClient
instance:
<a id='snippet-httpclient_signinghttpmessagehandler'></a>
var signatureAlgorithm = SignatureAlgorithm.Create(rsaOrECDsaAlgorithm);
var config = new HttpMessageSigningConfiguration("key-id", signatureAlgorithm);
var handler = new SigningHttpMessageHandler(config);
using var client = new HttpClient(handler);
// Make requests using client :)
<sup><a href='/test/IdentityStream.HttpMessageSigning.Tests/Snippets.cs#L30-L40' title='Snippet source file'>snippet source</a> | <a href='#snippet-httpclient_signinghttpmessagehandler' title='Start of snippet'>anchor</a></sup>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- IdentityStream.HttpMessageSigning (>= 3.2.1)
- System.ServiceModel.Http (>= 4.10.3)
-
net8.0
- IdentityStream.HttpMessageSigning (>= 3.2.1)
- System.ServiceModel.Http (>= 6.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.