title: Convert NSData to String?
body: <p>I am storing a openssl private Key EVP_PKEY as nsdata. For this I am serializing into a byte stream using the code below</p>
  
  <pre><code>unsigned char *buf, *p;
  int len;
  len = i2d_PrivateKey(pkey, NULL);
  buf = OPENSSL_malloc(len); 
  p = buf;
  i2d_PrivateKey(pkey, &amp;p);
  </code></pre>
  
  <p>where pkey  is of type EVP_PKEY.
  Then I am storing the bytes from buffer 'p' as an NSData using the line given below</p>
  
  <pre><code>NSData *keydata = [NSData dataWithBytes:P length:len];
  </code></pre>
  
  <p>Now I am converting it to a NSString using the code given below but when i print it into console its giving some other characters.</p>
  
  <pre><code>NSString *content =[ NSString stringWithCString:[keydata bytes] encoding:NSUTF8StringEncoding];
  </code></pre>
  
  <p>Could someone help? </p>
  
  <blockquote>
    <p>Basically I want to store the EVP_PKEY
    into a sqlite database</p>
  </blockquote>
  
  <p>am I on the right track?
  Thanks.</p>