コード例 #1
0
 public int Decrypt(MobilpayDecrypt mobilpayDecrypt)
 {
     try
     {
         StreamReader streamReader = File.OpenText(mobilpayDecrypt.PrivateKeyFilePath);
         string       sPrivKey     = streamReader.ReadToEnd().Trim();
         streamReader.Close();
         RSACryptoServiceProvider decodedPrivKeyInfo = opensslkey.GetDecodedPrivKeyInfo(sPrivKey);
         byte[] rgb   = Convert.FromBase64String(mobilpayDecrypt.EnvelopeKey);
         byte[] bytes = Convert.FromBase64String(mobilpayDecrypt.Data);
         try
         {
             byte[] key = decodedPrivKeyInfo.Decrypt(rgb, false);
             this.RC4(ref bytes, key);
             mobilpayDecrypt.DecryptedData = Encoding.ASCII.GetString(bytes);
         }
         catch (CryptographicException ex)
         {
             throw ex;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(0);
 }
コード例 #2
0
 public Mobilpay_Payment_Request_Card BuildCardDecrypt(
     MobilpayDecrypt mobilpayDecrypt)
 {
     try
     {
         Mobilpay_Payment_Request_Card paymentRequestCard = new Mobilpay_Payment_Request_Card();
         if (Decrypt(mobilpayDecrypt) == 0)
         {
             return(this.GetCard(mobilpayDecrypt.DecryptedData));
         }
         Exception exception = new Exception("0x300000f3");
         return((Mobilpay_Payment_Request_Card)null);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }