Table of Contents

Class UriExtensions

Namespace
Cuemon.Extensions.Net.Security
Assembly
Cuemon.Extensions.Net.dll

Extension methods for the System.Uri class.

public static class UriExtensions
Inheritance
Object
UriExtensions

Methods

ToSignedUri(Uri, Byte[], Nullable<DateTime>, Nullable<DateTime>, Action<SignedUriOptions>)

Converts the specified uri to a signed and tampering protected System.Uri.

public static Uri ToSignedUri(this Uri uri, byte[] secret, DateTime? signedStart = null, DateTime? signedExpiry = null, Action<SignedUriOptions> setup = null)

Parameters

uri Uri

The URI to protect from tampering.

secret Byte[]

The secret key for the encryption.

signedStart Nullable<DateTime>

The time, expressed as the Coordinated Universal Time (UTC), at which the signed URI becomes valid.

signedExpiry Nullable<DateTime>

The time, expressed as the Coordinated Universal Time (UTC), at which the signed URI becomes invalid.

setup Action<SignedUriOptions>

The SignedUriOptions which may be configured.

Returns

Uri

A System.Uri that is equivalent to uri but signed and protected from tampering.

ValidateSignedUri(Uri, Byte[], Action<SignedUriOptions>)

Reads and validates the specified signedUri.

public static void ValidateSignedUri(this Uri signedUri, byte[] secret, Action<SignedUriOptions> setup = null)

Parameters

signedUri Uri

The signed URI that needs to be validated.

secret Byte[]

The secret key for the encryption.

setup Action<SignedUriOptions>

The SignedUriOptions which may be configured.

Exceptions

System.Security.SecurityException

signedUri did not have a signature specified - or - signedUri has an invalid signature.

See Also