title: Decrypt a base64 encoded and aes encrypted string using RNCryptor
body: <p>I am just new to RNCryptor but I have been given a sample string which is encrypted and base64 encoded. I am trying to use the RNCryptor decrypt func to see the string in plain text.</p>
  
  <p>I tried the following:</p>
  
  <pre><code>func decryptStr(_ sample : String){
  
      let sampleBase64Decoded = sample.fromBase64Data()
  
      do {
          let decryptedNSData = try RNCryptor.decrypt(data: sampleBase64Decoded!, withPassword: "secretPass")
          let decryptedNSString = NSString(data: decryptedNSData, encoding: String.Encoding.utf8.rawValue)
          print("decrypted : \(decryptedNSString)")
      }
      catch let error as NSError {
          print("issue decrypting :\(error.localizedDescription)")
      }
  
  }
  </code></pre>
  
  <p>and I am calling it like so:</p>
  
  <pre><code>decryptStr("R79gQDNTt/0+cjU7pduqfA==")
  </code></pre>
  
  <p>and the fromBase64 looks like so:</p>
  
  <pre><code>extension String {
  
  func fromBase64() -&gt; String? {
      guard let data = Data(base64Encoded: self, options: NSData.Base64DecodingOptions(rawValue: 0)) else {
          return nil
      }
  
      return String(data: data, encoding: String.Encoding.utf8)!
  }
  
  }
  </code></pre>
  
  <p>I am receiving the error connect.RNCryptor.Error error 2. Why would this be? Is it in any way related to the fact that the string is both base 64 encoded and also encrypted?</p>
  
  <p>The password is correct.</p>