      * 				解密数据
      *
      */
+    
     func decrypt(key:NSData , encrypt_bytes:NSData,iv:NSData) ->NSData?{
         // Create Cryptor
-        var  cryptor :CCCryptorRef = CCCryptorRef();
-        
-        let  createDecrypt:CCCryptorStatus = CCCryptorCreateWithMode(CCOperation(kCCDecrypt), // operation
-            CCMode(kCCModeCFB), // mode CTR
-            CCAlgorithm(kCCAlgorithmAES128),//kCCAlgorithmAES, // Algorithm
-            CCPadding(ccNoPadding), // padding
-            iv.bytes, // can be NULL, because null is full of zeros
-            key.bytes, // key
-            key.length, // keylength
-            nil, //const void *tweak
-            0, //size_t tweakLength,
-            0, //int numRounds,
-            0, //CCModeOptions options,
-            &cryptor); //CCCryptorRef *cryptorRef
-        
-        
-        if (createDecrypt == CCCryptorStatus(kCCSuccess))
-        {
+        
+        if recv_ctx == nil {
+            recv_ctx = enc_ctx.init(key: key, iv: iv, encrypt: false, method: m)
+        }else {
+            if recv_ctx!.ctx == nil {
+                let  createDecrypt:CCCryptorStatus = CCCryptorCreateWithMode(CCOperation(kCCDecrypt), // operation
+                    CCMode(kCCModeCFB), // mode CTR
+                    CCAlgorithm(kCCAlgorithmAES128),//kCCAlgorithmAES, // Algorithm
+                    CCPadding(ccNoPadding), // padding
+                    iv.bytes, // can be NULL, because null is full of zeros
+                    key.bytes, // key
+                    key.length, // keylength
+                    nil, //const void *tweak
+                    0, //size_t tweakLength,
+                    0, //int numRounds,
+                    0, //CCModeOptions options,
+                    &recv_ctx!.ctx); //CCCryptorRef *cryptorRef
+                if (createDecrypt == CCCryptorStatus(kCCSuccess)){
+                    AxLogger.log("create decrypt env error", level: .Error)
+                    
+                }
+            }
+        }
+        
+        
+        
+        
+        let ctx = recv_ctx!.ctx
+        
             // Alloc Data Out
             let cipherDataDecrypt:NSMutableData = NSMutableData.init(capacity:encrypt_bytes.length+kCCBlockSizeAES128)!;
             

//    private KeyGenerator keyGenerator = null;
    
    //var key:NSData? //加密的key
    var iv:NSData?
    
    init (passwd:String) {
        //m = CryptoMethod.init(cipher: "aes-256-cfb")

import Security


//
//  Encrypt.swift
//  Surf
//
//  Created by yarshure on 16/5/12.
//  Copyright © 2016年 yarshure. All rights reserved.
//
// gfw.press support
import Foundation
import Security


//let kChosenCipherBlockSize = kCCBlockSizeAES128
//let kChosenCipherKeySize = kCCKeySizeAES128
//import CryptoSwift
