title: How to convert string to data with 32 bytes count in iOS Swift 3.1
body: <p>How to convert string to data or NSData with 32 bytes count in iOS Swift 3.<br>
  I have a key like this:  </p>
  
  <pre><code>let keyString = "hpXa6pTJOWDAClC/J6POVTjvJpMIiPAMQiTMjBrcOGw=" 
  </code></pre>
  
  <p>and test this code for convert to Data:  </p>
  
  <pre><code>let keyData: Data = keyString.data(using: String.Encoding(rawValue: String.Encoding.utf8.rawValue))!  
  let keyLength = keyData.count //44
  </code></pre>
  
  <p>key length is 44.<br>
  I need convert with 32 because valid key bytes count should be equals: 16 or 24 or 32 base on this cases:  </p>
  
  <pre><code>let validKeyLengths = [kCCKeySizeAES128, kCCKeySizeAES192, kCCKeySizeAES256]
  </code></pre>