Re: Application requirement for persistent key pairs



Many thanks Doug for your reply. I have a couple of additional questions
regarding the modification of ACLs on the key container (which is the
preferred suggestion).

If a service is running as "ServiceAccoutA" and is using a key container of
"KeyContainerA" and a key import process creates the container and imports
the keys (which should be run as user "KeyUpdateA") is it best to first
retrieve the the DACL (using CryptGetProvParam a dwParam of
PP_KEYSET_SEC_DESCR and a dwFlags of DACL_SECURITY_INFORMATION) - remove all
ACEs and then explicitly add a read permission for "ServiceAccountA" and a
write permission for the account that should run the key import application
("KeyUpdateA")?

What is the default DACL created for a key container? Is it only the DACL
and SACL I need to modify in this way to secure the container adequately?

Thanks in advance,
Tim

"Doug Barlow" wrote:

You do have a few options. You are correct, the CRYPT_MACHINE_KEYSET will
make key available to your service, as well as everyone else on the system.
You can import key pairs, and they will be persisted.

You can also import the key pairs with the CRYPT_VERIFYCONTEXT flag on the
CryptAcquireContext. That will make the keys usable, but will not persist
them. Then you can reload them each time your service needs them, and
protect their storage medium as you see fit.

Or, once imported, you can call CryptSetProvParam with PP_KEYSET_SEC_DESCR
and set the ACLs on the key file so that only your service account can
access the keys.

Doug Barlow
The Soft Pedal Shop
CSP Design & Development Consulting
http://www.SoftPedal.net
--
"Tim" <Tim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FC53C9F4-B202-4EA4-833E-83855448CA6F@xxxxxxxxxxxxxxxx
If an application deployed as a service which requires private key
operations
(assuming the application signs information that it produces) then I
believe
I need to CryptAcquireContext with the flag CRYPT_MACHINE_KEYSET as I will
not have a user profile for the key container?

If I name my container something appropriate for my application to access
and generate (or import) AT_EXCHANGE and AT_SIGNATURE key pairs, for use
by
the application, will these keys be persisted? I assume within
"C:\Documents
and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys"?

Hopefully the answer to the above is yes which leads to my final
question -
what protects these keys? If another application runs as the local system
and
it enumerates the containers (or finds out the container I am using from
my
code) can it simply gain access to the private keys through the CryptoAPI
and
possibly pose as my service?

Thanks for any help/guidance on this query.
Tim.



.



Relevant Pages

  • Re: Expanding partition on drive C
    ... "Doug" wrote in message ... container with the Dell server software. ... to re-install Windows 2000 SBS and reformat the first entire container ...
    (microsoft.public.backoffice.smallbiz2000)
  • Re: [rant] Missing sock syndrome
    ... The large centre container looks just like the floor of my van ... Doug L ...
    (alt.security.alarms)
  • Re: Application requirement for persistent key pairs
    ... You can import key pairs, ... protect their storage medium as you see fit. ... I need to CryptAcquireContext with the flag CRYPT_MACHINE_KEYSET as I will ... If I name my container something appropriate for my application to access ...
    (microsoft.public.platformsdk.security)
  • Re: Can Cryptoapi key container have several exchange/signature ke
    ... Any container may have of maximum one AT_KEYEXCHANGE and maximum one ... AT_SIGNATURE keypairs - and this must be obeyed by each CSP. ... >> key pairs to the key container by calling CryptGenKeyrepeatly? ...
    (microsoft.public.platformsdk.security)
  • Re: Private key different; Public key same on Different Machines
    ... Okay, that clears things up. ... I didn't realize that there were two key pairs ... in the container. ... the Crypto API has always eluded me a little. ...
    (microsoft.public.dotnet.security)