all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Modifying Emacs to use the Mac OS X Keychain Services
@ 2011-05-30  1:08 Ben Key
  2011-05-30  1:19 ` Daniel Colascione
  2011-05-30 12:27 ` Ted Zlatanov
  0 siblings, 2 replies; 48+ messages in thread
From: Ben Key @ 2011-05-30  1:08 UTC (permalink / raw)
  To: Emacs Development

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

Hello,

I am working on this task.  I need some advice.

The Keychain Services allows you to store items in the Default Keychain, the
Login Keychain (which may be the Default Keychain), or in a separate
Keychain file.  Should I use the Default Keychain or use an Emacs specific
Keychain file?  The benefit of using the Default Keychain is that the user
should never be prompted to provide a password for the Keychain.  However,
keeping the passwords in a separate, Emacs specific, Keychain file would
have the benefit of keeping the passwords used by Emacs separate from other
passwords.

Any opinions?

[-- Attachment #2: Type: text/html, Size: 700 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread
* Re: Modifying Emacs to use the Mac OS X Keychain Services
@ 2011-06-12  2:28 Ben Key
  2011-06-12  4:18 ` Ben Key
  2011-06-12 22:21 ` Ted Zlatanov
  0 siblings, 2 replies; 48+ messages in thread
From: Ben Key @ 2011-06-12  2:28 UTC (permalink / raw)
  To: Emacs Development, Ted Zlatanov

Ted Zlatanov wrote:

> Provide a `ns-keychain-open' and a `ns-keychain-create' (plus a
> `ns-keychain-create-or-open' convenience function if you wish, and a
> `ns-keychain-delete' if you think it's safe).

I had planed to allow each of the ns-keychain functions to take a
keychain parameter that was a string and open or create the keychain
automatically.  But the design you recommend will actually make things
easier.  This is the design I will use then.

Note that to avoid resource leaks, I will also have to provide a
ns-keychain-close function.



^ permalink raw reply	[flat|nested] 48+ messages in thread
* Re: Modifying Emacs to use the Mac OS X Keychain Services
@ 2011-06-11  0:30 Ben Key
  2011-06-11  1:13 ` Ted Zlatanov
  0 siblings, 1 reply; 48+ messages in thread
From: Ben Key @ 2011-06-11  0:30 UTC (permalink / raw)
  To: Emacs Development, Ted Zlatanov

Hello,

Ted Zlatanov wrote:

> Please throw an error if the requested keychain doesn't exist, same as
> above.

It may be more useful to only throw the error for the "session" or
"secrets:session" values for the keychain parameter and to handle
values other than "login," "secrets:Login," "default,"
"secrets:default," "session", or "secrets:session" as an indication
that a keychain file named ~/Library/Keychains/{keychain}.keychain
should be used.  If this keychain file exists, I can open it using
SecKeychainOpen.  If the keychain file does not exist I can create it
with SecKeychainCreate.  What do you think of this idea?

> Don't be afraid of diverging from the Secrets API.  The Keychain
> Services API is not the same thing, we know that.  Please add that
> parameter to the calls.

OK.  I will abandon my attempt to conform to the Secrets API.  This
will actually make things a little easier.  I will provide a Keychain
and Service Name parameter for each of my new functions.

> Are you providing both SecKeychain*GenericPassword and
> SecKeychain*InternetPassword?

Yes, I will provide access to both the Generic Password and Internet
Password functions.



^ permalink raw reply	[flat|nested] 48+ messages in thread
* Re: Modifying Emacs to use the Mac OS X Keychain Services
@ 2011-06-05 23:23 Ben Key
  2011-06-06  0:05 ` Ted Zlatanov
  0 siblings, 1 reply; 48+ messages in thread
From: Ben Key @ 2011-06-05 23:23 UTC (permalink / raw)
  To: Emacs Development, Ted Zlatanov

[-- Attachment #1: Type: text/plain, Size: 2210 bytes --]

Ted Zlatanov wrote:

*> Right, so the name of the collection is the serviceName as far as the OS
> is concerned.  That means it could be stored anywhere, right?
*
Yes.  A keychain item for a given serviceName can be stored anywhere.

*> Does the user care what file it's stored in?  Can you have any
> serviceName in any file, or is there some connection or dependency
> between the two?
*
I do not know if the user cares what file it is stored in.  I just know what
I see in auth-source.el.  In the auth-sources defcustom I see several items
that appear to be related to using the secrets API as defined in
secrets.el.  They are as follows:
  (const :tag "Default Secrets API Collection" 'default)
  (const :tag "Login Secrets API Collection" "secrets:Login")
  (const :tag "Temp Secrets API Collection" "secrets:session")

The value assigned to the auth-sources defcustom appears to be associated
with the collection parameter that is used when calling secrets-get-secret
and secrets-get-attributes.  I do not know enough Lisp to be certain of
that.  It is the "secrets:Login" item that made me think I was
misinterpreting the collection parameter in my implementation.  This item
seems to exactly describe the Login keychain file in Mac OS X.  The default
item seems to be analogous to the default keychain in Mac OS X, which is by
default the Login keychain but can be changed to a user defined keychain
file using the Keychain Access application.

As for your question about whether you can have any serviceName in any file,
yes you can.  There is no dependency or connection between the serviceName
parameter and the keychain file.

I just want to do this right.  If the right approach is to use the default
keychain by default providing a way to customize Emacs to use another
keychain file and interpreting the collection parameter as the service name,
then that is the approach I will use.  But, if I should instead use the
collection parameter as an indication of which keychain file to use, as the
three "Secrets API Collection" items in the auth-sources defcustom imply I
should, then that is the approach I will use.

It seems that you favor the first approach.  Are there any other opinions?
*
*

[-- Attachment #2: Type: text/html, Size: 2455 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread
* Modifying Emacs to use the Mac OS X Keychain Services
@ 2011-06-01  2:04 Ben Key
  2011-06-01  2:13 ` Ted Zlatanov
  2011-06-05 18:54 ` Ben Key
  0 siblings, 2 replies; 48+ messages in thread
From: Ben Key @ 2011-06-01  2:04 UTC (permalink / raw)
  To: Emacs Development

[-- Attachment #1: Type: text/plain, Size: 1700 bytes --]

Hello,

I am still working on this task.  I did not finish it by Today as I
expected.

So far I am working on the ns-keychain-create-item function and the
ns-keychain-get-secret function.  I will add more functions as I go on.

For those who are wondering, here are some details on how I am implementing
these functions.

The ns-keychain-create-item function has the same parameters as
secrets-create-item (collection, item, password, and &rest attributes).  It
essentially just calls the Keychain Services API functions
SecKeychainAddGenericPassword to create the password and
SecKeychainItemModifyAttributesAndData to process the attributes.  When I
call SecKeychainAddGenericPassword I map the collection parameter to the
serviceName parameter, the item parameter to the accountName, and the
password parameter to the passwordData parameter.

The ns-keychain-get-secret function has the same parameters as
secrets-get-secret (collection and item) and it essentially just calls
SecKeychainFindGenericPassword and returns the retrieved passwordData
parameter.  Again, when calling SecKeychainFindGenericPassword I map the
collection parameter to the serviceName parameter and the item parameter to
the accountName parameter.

Since I can only work on this project on nights and weekends, it may take me
several weeks to complete this task.  As Daniel Colascione and Ted Zlatanov
recommended I am making the Keychain file the passwords used by Emacs a
configurable option that defaults to the default Keychain file.

Once I am finished with this task, I will post a patch to this list so that
the community can review it before I check it in.  It is my hope that this
patch will be ready in 3 weeks.

[-- Attachment #2: Type: text/html, Size: 1971 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread
* Re: Modifying Emacs to use the Mac OS X Keychain Services
@ 2011-05-28 18:32 Ben Key
  0 siblings, 0 replies; 48+ messages in thread
From: Ben Key @ 2011-05-28 18:32 UTC (permalink / raw)
  To: Emacs Development, tzz

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]

Hello,

Thanks Ted for the example on how to implement support with for the
attributes parameter.  That is exactly what I needed.

I will begin working on writing ns- functions that mirror the signatures and
functionality of the secrets.el functions as closely as possible using the
Keychain Services API.  I hope to make some significant progress in this
task by Tuesday.

Once I have added the ns- functions to Emacs, I will most likely need
assistance modifying auth-source.el to use them since I do not know Lisp
nearly as well as I do C/C++.

[-- Attachment #2: Type: text/html, Size: 600 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread
* Modifying Emacs to use the Mac OS X Keychain Services
@ 2011-05-28  2:56 Ben Key
  2011-05-28 11:09 ` Michael Albinus
  0 siblings, 1 reply; 48+ messages in thread
From: Ben Key @ 2011-05-28  2:56 UTC (permalink / raw)
  To: Emacs-devel, tzz

[-- Attachment #1: Type: text/plain, Size: 705 bytes --]

Hello,

I have been looking into what it will take to add support for the Mac OS X
Keychain Services to Emacs.  It looks like what I need to do is to make
changes to lisp/net/secrets.el.  Specifically I need to modify the functions
secrets-create-item, secrets-delete-item, secrets-get-alias,
secrets-get-attributes, secrets-get-secret, secrets-list-collections, and
secrets-search-items so that on Mac OS X they call new built in functions
that use the Mac OS X Keychain Services instead of using dbus-call-method to
communicate with the "org.freedesktop.secrets" service.

Is that an accurate assessment of what needs to be done?  If it is, just let
me know and I will begin working on it this weekend.

[-- Attachment #2: Type: text/html, Size: 784 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2012-08-20 14:02 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-30  1:08 Modifying Emacs to use the Mac OS X Keychain Services Ben Key
2011-05-30  1:19 ` Daniel Colascione
2011-05-30 12:27 ` Ted Zlatanov
  -- strict thread matches above, loose matches on Subject: below --
2011-06-12  2:28 Ben Key
2011-06-12  4:18 ` Ben Key
2011-06-12 16:40   ` Eli Zaretskii
2011-06-12 22:23     ` Ted Zlatanov
2011-06-13  3:14     ` Ben Key
2011-06-14  3:12   ` Stefan Monnier
2011-06-15  2:15     ` Ben Key
2011-06-15 15:12       ` Ted Zlatanov
2011-06-15 16:30         ` Andreas Schwab
2011-06-15 20:02           ` Ted Zlatanov
2011-06-15 23:26         ` Stefan Monnier
2011-06-17 20:31           ` Chong Yidong
2011-06-12 22:21 ` Ted Zlatanov
2011-06-11  0:30 Ben Key
2011-06-11  1:13 ` Ted Zlatanov
2011-06-05 23:23 Ben Key
2011-06-06  0:05 ` Ted Zlatanov
2011-06-01  2:04 Ben Key
2011-06-01  2:13 ` Ted Zlatanov
2011-06-05 18:54 ` Ben Key
2011-06-05 20:01   ` Ted Zlatanov
2011-06-06 20:26   ` Michael Albinus
2011-06-07  3:34     ` Ben Key
2011-06-07  7:58       ` Michael Albinus
     [not found]         ` <BANLkTin1DxY33iaQ5=9KJKD_gwQvsJwJ8Q@mail.gmail.com>
2011-06-08  5:50           ` Ben Key
2011-06-08 20:48             ` Ted Zlatanov
2012-07-27 15:20               ` Dave Abrahams
2012-07-28 12:16                 ` Harald Hanche-Olsen
2012-07-28 16:33                   ` Dave Abrahams
2012-07-28 16:45                     ` Harald Hanche-Olsen
2012-07-29 22:05                 ` Ted Zlatanov
2012-07-30 13:34                   ` Michael Albinus
2012-07-31 15:45                     ` Ted Zlatanov
2012-08-20 13:42                   ` Dave Abrahams
2012-08-20 13:49                   ` Dave Abrahams
2012-08-20 14:02                     ` Dave Abrahams
2011-05-28 18:32 Ben Key
2011-05-28  2:56 Ben Key
2011-05-28 11:09 ` Michael Albinus
2011-05-28 13:00   ` Ben Key
2011-05-28 14:32     ` Michael Albinus
2011-05-28 17:16       ` Ben Key
2011-05-28 18:13         ` Ted Zlatanov
2011-05-28 19:38         ` Michael Albinus
2011-05-28 15:11     ` Ted Zlatanov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.