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
uriStringstringThe URI to protect from tampering.
secretbyte[]The secret key for the encryption.
startDateTime?The time, expressed as the Coordinated Universal Time (UTC), at which the signed URI becomes valid.
expiryDateTime?The time, expressed as the Coordinated Universal Time (UTC), at which the signed URI becomes invalid.
setupAction<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
uriStringcannot be null - or -secretcannot be null.- ArgumentException
uriStringcannot 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
signedUriStringstringThe signed URI that needs to be validated.
secretbyte[]The secret key for the encryption.
setupAction<SignedUriOptions>The SignedUriOptions which may be configured.
Exceptions
- SecurityException
signedUriStringhas an invalid signature.
- See Also