Class WebSecurityUtilityExtensions
This is an extension implementation of the most common methods on the WebSecurityUtility class.
Inheritance
Namespace: Cuemon.Web.Security
Assembly: Cuemon.Web.dll
Syntax
public static class WebSecurityUtilityExtensions
Methods
| Improve this DocToProtectedUri(String, Byte[])
Converts the specified uriLocation
to a tampering protected System.Uri.
Declaration
public static Uri ToProtectedUri(this string uriLocation, byte[] securityKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | uriLocation | The URI to protect from tampering. |
System.Byte[] | securityKey | The security key to use for the SecurityToken encryption. |
Returns
Type | Description |
---|---|
System.Uri | An URI equivalent to the |
ToProtectedUri(String, Byte[], SecurityTokenSettings)
Converts the specified uriLocation
to a tampering protected System.Uri.
Declaration
public static Uri ToProtectedUri(this string uriLocation, byte[] securityKey, SecurityTokenSettings settings)
Parameters
Type | Name | Description |
---|---|---|
System.String | uriLocation | The URI to protect from tampering. |
System.Byte[] | securityKey | The security key to use for the SecurityToken encryption. |
SecurityTokenSettings | settings | The settings to apply to the SecurityToken. |
Returns
Type | Description |
---|---|
System.Uri | An URI equivalent to the |
ToProtectedUri(String, Byte[], SecurityTokenSettings, HashAlgorithmType)
Converts the specified uriLocation
to a tampering protected System.Uri.
Declaration
public static Uri ToProtectedUri(this string uriLocation, byte[] securityKey, SecurityTokenSettings settings, HashAlgorithmType algorithmType)
Parameters
Type | Name | Description |
---|---|---|
System.String | uriLocation | The URI to protect from tampering. |
System.Byte[] | securityKey | The security key to use for the SecurityToken encryption. |
SecurityTokenSettings | settings | The settings to apply to the SecurityToken. |
HashAlgorithmType | algorithmType | The hash algorithm to use for the URI checksum computation. Default is SHA1. |
Returns
Type | Description |
---|---|
System.Uri | An URI equivalent to the |
ToProtectedUri(String, Byte[], SecurityTokenSettings, HashAlgorithmType, String)
Converts the specified uriLocation
to a tampering protected System.Uri.
Declaration
public static Uri ToProtectedUri(this string uriLocation, byte[] securityKey, SecurityTokenSettings settings, HashAlgorithmType algorithmType, string secureUriFormat)
Parameters
Type | Name | Description |
---|---|---|
System.String | uriLocation | The URI to protect from tampering. |
System.Byte[] | securityKey | The security key to use for the SecurityToken encryption. |
SecurityTokenSettings | settings | The settings to apply to the SecurityToken. |
HashAlgorithmType | algorithmType | The hash algorithm to use for the URI checksum computation. Default is SHA1. |
System.String | secureUriFormat | The naming format of the required query string parameters of the tamper protected URI. Default is ?token={0}&iv={1}&salt={2}, where you can change the naming of the query string parameters. |
Returns
Type | Description |
---|---|
System.Uri | An URI equivalent to the |
ToProtectedUri(String, Byte[], SecurityTokenSettings, HashAlgorithmType, String, String)
Converts the specified uriLocation
to a tampering protected System.Uri.
Declaration
public static Uri ToProtectedUri(this string uriLocation, byte[] securityKey, SecurityTokenSettings settings, HashAlgorithmType algorithmType, string secureUriFormat, string querystringParameterHashName)
Parameters
Type | Name | Description |
---|---|---|
System.String | uriLocation | The URI to protect from tampering. |
System.Byte[] | securityKey | The security key to use for the SecurityToken encryption. |
SecurityTokenSettings | settings | The settings to apply to the SecurityToken. |
HashAlgorithmType | algorithmType | The hash algorithm to use for the URI checksum computation. Default is SHA1. |
System.String | secureUriFormat | The naming format of the required query string parameters of the tamper protected URI. Default is ?token={0}&iv={1}&salt={2}, where you can change the naming of the query string parameters. |
System.String | querystringParameterHashName | The name of the checksum parameter to append to the tampering protected URI. Default is hash. |
Returns
Type | Description |
---|---|
System.Uri | An URI equivalent to the |
ToProtectedUri(Uri, Byte[])
Converts the specified location
to a tampering protected System.Uri.
Declaration
public static Uri ToProtectedUri(this Uri location, byte[] securityKey)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The URI to protect from tampering. |
System.Byte[] | securityKey | The security key to use for the SecurityToken encryption. |
Returns
Type | Description |
---|---|
System.Uri | An URI equivalent to the |
ToProtectedUri(Uri, Byte[], SecurityTokenSettings)
Converts the specified location
to a tampering protected System.Uri.
Declaration
public static Uri ToProtectedUri(this Uri location, byte[] securityKey, SecurityTokenSettings settings)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The URI to protect from tampering. |
System.Byte[] | securityKey | The security key to use for the SecurityToken encryption. |
SecurityTokenSettings | settings | The settings to apply to the SecurityToken. |
Returns
Type | Description |
---|---|
System.Uri | An URI equivalent to the |
ToProtectedUri(Uri, Byte[], SecurityTokenSettings, HashAlgorithmType)
Converts the specified location
to a tampering protected System.Uri.
Declaration
public static Uri ToProtectedUri(this Uri location, byte[] securityKey, SecurityTokenSettings settings, HashAlgorithmType algorithmType)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The URI to protect from tampering. |
System.Byte[] | securityKey | The security key to use for the SecurityToken encryption. |
SecurityTokenSettings | settings | The settings to apply to the SecurityToken. |
HashAlgorithmType | algorithmType | The hash algorithm to use for the URI checksum computation. Default is SHA1. |
Returns
Type | Description |
---|---|
System.Uri | An URI equivalent to the |
ToProtectedUri(Uri, Byte[], SecurityTokenSettings, HashAlgorithmType, String)
Converts the specified location
to a tampering protected System.Uri.
Declaration
public static Uri ToProtectedUri(this Uri location, byte[] securityKey, SecurityTokenSettings settings, HashAlgorithmType algorithmType, string secureUriFormat)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The URI to protect from tampering. |
System.Byte[] | securityKey | The security key to use for the SecurityToken encryption. |
SecurityTokenSettings | settings | The settings to apply to the SecurityToken. |
HashAlgorithmType | algorithmType | The hash algorithm to use for the URI checksum computation. Default is SHA1. |
System.String | secureUriFormat | The naming format of the required query string parameters of the tamper protected URI. Default is ?token={0}&iv={1}&salt={2}, where you can change the naming of the query string parameters. |
Returns
Type | Description |
---|---|
System.Uri | An URI equivalent to the |
ToProtectedUri(Uri, Byte[], SecurityTokenSettings, HashAlgorithmType, String, String)
Converts the specified location
to a tampering protected System.Uri.
Declaration
public static Uri ToProtectedUri(this Uri location, byte[] securityKey, SecurityTokenSettings settings, HashAlgorithmType algorithmType, string secureUriFormat, string querystringParameterHashName)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The URI to protect from tampering. |
System.Byte[] | securityKey | The security key to use for the SecurityToken encryption. |
SecurityTokenSettings | settings | The settings to apply to the SecurityToken. |
HashAlgorithmType | algorithmType | The hash algorithm to use for the URI checksum computation. Default is SHA1. |
System.String | secureUriFormat | The naming format of the required query string parameters of the tamper protected URI. Default is ?token={0}&iv={1}&salt={2}, where you can change the naming of the query string parameters. |
System.String | querystringParameterHashName | The name of the checksum parameter to append to the tampering protected URI. Default is hash. |
Returns
Type | Description |
---|---|
System.Uri | An URI equivalent to the |
VerifyProtectedUri(Uri, Byte[])
Parses and verifies the tampering protected URI.
Declaration
public static void VerifyProtectedUri(this Uri protectedUri, byte[] securityKey)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | protectedUri | The tampering protected URI. |
System.Byte[] | securityKey | The security key to use in the decryption of a SecurityToken. |
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | This exception is thrown when an unsucessfull parse is meet, hence values has been tampered with, |
VerifyProtectedUri(Uri, Byte[], String)
Parses and verifies the tampering protected URI.
Declaration
public static void VerifyProtectedUri(this Uri protectedUri, byte[] securityKey, string token)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | protectedUri | The tampering protected URI. |
System.Byte[] | securityKey | The security key to use in the decryption of the |
System.String | token | The security token to decrypt and parse for a SecurityToken. |
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | This exception is thrown when an unsucessfull parse is meet, hence values has been tampered with, |
VerifyProtectedUri(Uri, Byte[], String, String)
Parses and verifies the tampering protected URI.
Declaration
public static void VerifyProtectedUri(this Uri protectedUri, byte[] securityKey, string token, string iv)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | protectedUri | The tampering protected URI. |
System.Byte[] | securityKey | The security key to use in the decryption of the |
System.String | token | The security token to decrypt and parse for a SecurityToken. |
System.String | iv | The initialization vector (IV) to use in the decryption of the |
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | This exception is thrown when an unsucessfull parse is meet, hence values has been tampered with, |
VerifyProtectedUri(Uri, Byte[], String, String, String)
Parses and verifies the tampering protected URI.
Declaration
public static void VerifyProtectedUri(this Uri protectedUri, byte[] securityKey, string token, string iv, string salt)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | protectedUri | The tampering protected URI. |
System.Byte[] | securityKey | The security key to use in the decryption of the |
System.String | token | The security token to decrypt and parse for a SecurityToken. |
System.String | iv | The initialization vector (IV) to use in the decryption of the |
System.String | salt | The salt used in the computation of the integrity verification of |
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | This exception is thrown when an unsucessfull parse is meet, hence values has been tampered with, |
VerifyProtectedUri(Uri, Byte[], String, String, String, String)
Parses and verifies the tampering protected URI.
Declaration
public static void VerifyProtectedUri(this Uri protectedUri, byte[] securityKey, string token, string iv, string salt, string hash)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | protectedUri | The tampering protected URI. |
System.Byte[] | securityKey | The security key to use in the decryption of the |
System.String | token | The security token to decrypt and parse for a SecurityToken. |
System.String | iv | The initialization vector (IV) to use in the decryption of the |
System.String | salt | The salt used in the computation of the integrity verification of |
System.String | hash | The checksum to verify the integrity of |
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | This exception is thrown when an unsucessfull parse is meet, hence values has been tampered with, |
VerifyProtectedUri(Uri, Byte[], String, String, String, String, HashAlgorithmType)
Parses and verifies the tampering protected URI.
Declaration
public static void VerifyProtectedUri(this Uri protectedUri, byte[] securityKey, string token, string iv, string salt, string hash, HashAlgorithmType algorithmType)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | protectedUri | The tampering protected URI. |
System.Byte[] | securityKey | The security key to use in the decryption of the |
System.String | token | The security token to decrypt and parse for a SecurityToken. |
System.String | iv | The initialization vector (IV) to use in the decryption of the |
System.String | salt | The salt used in the computation of the integrity verification of |
System.String | hash | The checksum to verify the integrity of |
HashAlgorithmType | algorithmType | The hash algorithm to use for the |
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | This exception is thrown when an unsucessfull parse is meet, hence values has been tampered with, |
VerifyProtectedUri(Uri, Byte[], String, String, String, String, HashAlgorithmType, String)
Parses and verifies the tampering protected URI.
Declaration
public static void VerifyProtectedUri(this Uri protectedUri, byte[] securityKey, string token, string iv, string salt, string hash, HashAlgorithmType algorithmType, string querystringParameterHashName)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | protectedUri | The tampering protected URI. |
System.Byte[] | securityKey | The security key to use in the decryption of the |
System.String | token | The security token to decrypt and parse for a SecurityToken. |
System.String | iv | The initialization vector (IV) to use in the decryption of the |
System.String | salt | The salt used in the computation of the integrity verification of |
System.String | hash | The checksum to verify the integrity of |
HashAlgorithmType | algorithmType | The hash algorithm to use for the |
System.String | querystringParameterHashName | The name of the checksum parameter to remove from the |
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | This exception is thrown when an unsucessfull parse is meet, hence values has been tampered with, |