Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add the keyLabel to a private key?




On Jan 6, 2006, at 6:45 PM, Ben Zhu wrote:

If I use SecKeychainSetUserInterfaceAllowed(false), then the
SecKeychainItemExport will fail,
But if I don't use SecKeychainSetUserInterfaceAllowed,
SecKeychainItemExport pops up a dialog box.

Is there anyway to avoid the popup and let the SecKeychainItemExport
seliently go?

Sure.  You need to specify the password in a SecKeyImportExportParameters structure.  You have to get the password from someplace, but then you can just pass it as a CFStringRef.

paramBlock.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION;
paramBlock.flags = 0;
paramBlock.passphrase = passwordStrRef;
paramBlock.alertTitle = NULL;
paramBlock.alertPrompt = NULL;
paramBlock.accessRef = NULL;
paramBlock.keyUsage = CSSM_KEYUSE_ANY;
paramBlock.keyAttributes = CSSM_KEYATTR_RETURN_DEFAULT;
err = SecKeychainItemExport(keyRef, kSecFormatPKCS12, 0, &paramBlock, &exportedData);

Scott K.

------------------
Scott Kovatch
Apple Computer
Java Runtime Classes
Cleveland Hts, OH
email@hidden

I am Scott Kovatch, and I approved this message.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Apple-cdsa mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/apple-cdsa/email@hidden

This email sent to email@hidden

References: 
 >RE: How to add the keyLabel to a private key? (From: "Ben Zhu" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.