Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="customerKey"></param>
 public void SetCosServerSideEncryptionWithCustomerKey(string customerKey)
 {
     if (customerKey != null)
     {
         SetRequestHeader("x-cos-server-side-encryption-customer-algorithm", "AES256");
         SetRequestHeader("x-cos-server-side-encryption-customer-key", DigestUtils.GetBase64(customerKey, Encoding.UTF8));
         SetRequestHeader("x-cos-server-side-encryption-customer-key-MD5", DigestUtils.GetMd5ToBase64(customerKey, Encoding.UTF8));
     }
 }
 public override string GetMD5()
 {
     try
     {
         fileStream.Seek(fileOffset, SeekOrigin.Begin);
         return(DigestUtils.GetMd5ToBase64(fileStream, contentLength));
     }
     catch (Exception ex)
     {
         QLog.Error(TAG, ex.Message, ex);
         throw;
     }
 }
Esempio n. 3
0
        public static void testMd5(string path1, string path2)
        {
            Stream fileInputStream = new FileStream(path1, FileMode.Open, FileAccess.Read);
            string md51            = DigestUtils.GetMd5ToBase64(fileInputStream);

            fileInputStream.Close();

            Stream fileInputStream2 = new FileStream(path2, FileMode.Open, FileAccess.Read);
            string md52             = DigestUtils.GetMd5ToBase64(fileInputStream2);

            fileInputStream2.Close();

            Console.WriteLine(md51);
            Console.WriteLine(md52);
            Console.WriteLine(md51.CompareTo(md52));
        }
Esempio n. 4
0
 public override string GetMD5()
 {
     try
     {
         fileStream = new FileStream(srcPath, FileMode.Open, FileAccess.Read);
         fileStream.Seek(fileOffset, SeekOrigin.Begin);
         return(DigestUtils.GetMd5ToBase64(fileStream, contentLength));
     }
     catch (Exception ex)
     {
         QLog.E(TAG, ex.Message, ex);
         throw;
     }
     finally
     {
         if (fileStream != null)
         {
             fileStream.Close();
         }
     }
 }
Esempio n. 5
0
 public override string GetMD5()
 {
     return(DigestUtils.GetMd5ToBase64(data));
 }