/// <summary> /// Reads the data. /// </summary> /// <param name="reader">The reader.</param> /// <param name="additionalInfo">The additional information.</param> public void ReadData(FastBinaryReader reader, object additionalInfo) { Nonce = new CryptoNonce() { Key = reader.ReadByteArray(), IV = reader.ReadByteArray() }; }
/// <summary> /// Initializes a new instance of the <see cref="NonceContainer"/> class. /// </summary> /// <param name="nonce">The nonce.</param> public NonceContainer(CryptoNonce nonce) { Nonce = nonce; }
/// <summary> /// Aeses the encrypt serialize to64 base string. /// </summary> /// <param name="serializer">The serializer.</param> /// <param name="obj">The object.</param> /// <param name="nonce">The nonce.</param> /// <returns></returns> public static string AesEncryptSerializeTo64BaseString(IObjectSerializer serializer, object obj, CryptoNonce nonce) { return(AesEncryptSerializeTo64BaseString(serializer, obj, nonce.Key, nonce.IV)); }
/// <summary> /// Aeses the decrypt deserialize64 base string. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="serializer">The serializer.</param> /// <param name="sObj">The s object.</param> /// <param name="nonce">The nonce.</param> /// <returns></returns> public static T AesDecryptDeserialize64BaseString <T>(IObjectSerializer serializer, string sObj, CryptoNonce nonce) where T : class { return(AesDecryptDeserialize64BaseString <T>(serializer, sObj, nonce.Key, nonce.IV)); }
/// <summary> /// Aeses the decrypt deserialize object. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="serializer">The serializer.</param> /// <param name="bObj">The b object.</param> /// <param name="nonce">The nonce.</param> /// <returns></returns> public static T AesDecryptDeserializeObject <T>(IObjectSerializer serializer, byte[] bObj, CryptoNonce nonce) where T : class { return(AesDecryptDeserializeObject <T>(serializer, bObj, nonce.Key, nonce.IV)); }
/// <summary> /// Aeses the encrypt serialize object. /// </summary> /// <param name="serializer">The serializer.</param> /// <param name="obj">The object.</param> /// <param name="nonce">The nonce.</param> /// <returns></returns> public static byte[] AesEncryptSerializeObject(IObjectSerializer serializer, object obj, CryptoNonce nonce) { return(AesEncryptSerializeObject(serializer, obj, nonce.Key, nonce.IV)); }
/// <summary> /// Aeses the decrypt from64 base string. /// </summary> /// <param name="src">The source.</param> /// <param name="nonce">The nonce.</param> /// <returns></returns> public static byte[] AesDecryptFrom64BaseString(string src, CryptoNonce nonce) { return(AesDecryptFrom64BaseString(src, nonce.Key, nonce.IV)); }
/// <summary> /// Aeses the encrypt to64 base string. /// </summary> /// <param name="src">The source.</param> /// <param name="nonce">The nonce.</param> /// <returns></returns> public static string AesEncryptTo64BaseString(byte[] src, CryptoNonce nonce) { return(AesEncryptTo64BaseString(src, nonce.Key, nonce.IV)); }
/// <summary> /// Aeses the decrypt. /// </summary> /// <param name="src">The source.</param> /// <param name="nonce">The nonce.</param> /// <returns></returns> public static byte[] AesDecrypt(byte[] src, CryptoNonce nonce) { return(AesDecrypt(src, nonce.Key, nonce.IV)); }