security: OSXPrivateKeyStorage: When calling CFStringCreateWithCString, need to use kCFStringEncodingUTF8.
diff --git a/src/security/identity/osx-private-key-storage.cpp b/src/security/identity/osx-private-key-storage.cpp
index 136d054..f4fac6c 100644
--- a/src/security/identity/osx-private-key-storage.cpp
+++ b/src/security/identity/osx-private-key-storage.cpp
@@ -70,8 +70,8 @@
SecKeyRef publicKey, privateKey;
CFStringRef keyLabel = CFStringCreateWithCString(NULL,
- keyNameUri.c_str(),
- keyNameUri.size());
+ keyNameUri.c_str(),
+ kCFStringEncodingUTF8);
CFMutableDictionaryRef attrDict = CFDictionaryCreateMutable(NULL,
3,
@@ -108,8 +108,8 @@
&kCFTypeDictionaryValueCallBacks);
CFStringRef keyLabel = CFStringCreateWithCString(NULL,
- keyNameUri.c_str(),
- keyNameUri.size());
+ keyNameUri.c_str(),
+ kCFStringEncodingUTF8);
CFDictionaryAddValue(attrDict, kSecAttrKeyType, getSymKeyType(keyType));
CFDictionaryAddValue(attrDict, kSecAttrKeySizeInBits, CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &keySize));
@@ -368,8 +368,8 @@
string keyNameUri = toInternalKeyName(keyName, keyClass);
CFStringRef keyLabel = CFStringCreateWithCString(NULL,
- keyNameUri.c_str(),
- keyNameUri.size());
+ keyNameUri.c_str(),
+ kCFStringEncodingUTF8);
CFMutableDictionaryRef attrDict = CFDictionaryCreateMutable(NULL,
3,
@@ -394,9 +394,9 @@
{
string keyNameUri = toInternalKeyName(keyName, keyClass);
- CFStringRef keyLabel = CFStringCreateWithCString (NULL,
- keyNameUri.c_str(),
- keyNameUri.size());
+ CFStringRef keyLabel = CFStringCreateWithCString(NULL,
+ keyNameUri.c_str(),
+ kCFStringEncodingUTF8);
CFMutableDictionaryRef attrDict = CFDictionaryCreateMutable(NULL,
5,