Class StringExtensions
- Namespace
- Cuemon.Extensions.Net.Security
- Assembly
- Cuemon.Extensions.Net.dll
Extension methods for the string class.
public static class StringExtensions
- Inheritance
-
StringExtensions
Methods
ToSignedUri(string, byte[], DateTime?, DateTime?, Action<SignedUriOptions>)
Converts the specified uriString
to a signed and tampering protected Uri.
public static Uri ToSignedUri(this string uriString, byte[] secret, DateTime? start = null, DateTime? expiry = null, Action<SignedUriOptions> setup = null)
Parameters
uriString
stringThe URI to protect from tampering.
secret
byte[]The secret key for the encryption.
start
DateTime?The time, expressed as the Coordinated Universal Time (UTC), at which the signed URI becomes valid.
expiry
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
Remarks
If either of start
or expiry
has a Kind different from Utc, they will be adjusted without changing the value of the DateTime itself.
Exceptions
- ArgumentNullException
uriString
cannot be null - or -secret
cannot be null.- ArgumentException
uriString
cannot be empty or consist only of white-space characters.
- See Also
ValidateSignedUri(string, byte[], Action<SignedUriOptions>)
Reads and validates the specified signedUriString
.
public static void ValidateSignedUri(this string signedUriString, byte[] secret, Action<SignedUriOptions> setup = null)
Parameters
signedUriString
stringThe 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
- SecurityException
signedUriString
has an invalid signature.
- See Also