site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:resent-to:message-id:from:to :content-type:content-transfer-encoding:resent-date:resent-from :subject:mime-version:date:x-mailer; bh=mEX2ixhStgUygGv6moa59G189oEUg5ZrervuTDJtb3k=; b=uF4bvck6WAhk2Bh66rdZL2zidzbQx+zN9sS6s8tn5Iwp7smwYHcS1tzc45EyuiNkWj ju/FdHamJ5XvNEX8RxONCcRNiVSdJiRScpHqpGaEZGfnjhxJgGFLiOA3j00AxmozvuW/ PkkPfUeYh+JJdbxUNMa1avFWL3Sj0P6bXJywE= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=resent-to:message-id:from:to:content-type:content-transfer-encoding :resent-date:resent-from:subject:mime-version:date:x-mailer; b=mfZcDnbJ/o5oHdT0Ymz2cDKXQS65h916QxUe1RPVkLumRCYnZILTSx+GcOyeB3gs/H TvCi7fr7yhmeB5tinm0FZPbavsLUjx/ag0cB/dPSjKt0B/WoFTsLyBt2LS8mKP9ynd3M Nn4rnzsZRKfLD8KO0XABfpARIkMvR9uZiU+ws= Resent-date: Wed, 3 Jun 2009 13:37:36 -0400 Resent-from: Ryan Govostes <rgovostes@gmail.com> Resent-message-id: <20090603173740.547A98F2594D@relay3.apple.com> Resent-to: darwin-dev@lists.apple.com Hello, SecCertificateRef rootCert; CSSM_DATA cssmdata; CFStringRef commonName; SecCertificateCopyCommonName(rootCert, &commonName); Thanks, Ryan Govostes _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I have a certificate stored on disk in PEM format. I'd like to read it into a SecCertificateRef.
From some cursory reading, it looks like a PEM certificate is just Base64-encoded DER. So I manually decoded the Base64 and wrote the binary data to a file, which was read in like: cssmdata.Data = [certdata bytes];
cssmdata.Length = [certdata length]; SecCertificateCreateFromData(&cssmdata, CSSM_CERT_X_509v3, CSSM_CERT_ENCODING_DER, &rootCert); At this point SecCertificateCreateFromData returns noErr and things look like they're going well. However, any time I try to use the root certificate, i.e., SecCertificateCopyCommonName returns errSecDataNotAvailable (which is unexplained). I take it that this means that the certificate was not properly loaded from the data? Is there a better way to go about reading in the PEM file, other than doing so manually like I have done? Am I doing something incorrect that would cause the error code I am seeing? This email sent to site_archiver@lists.apple.com