Solved

Safest place/method to store private key?

Posted on 2004-04-09
19
643 Views
Last Modified: 2013-12-04
We use RSA within our app to encrypt/decrypt sensitive info.  The app has to have access to the private key to perform these operations.

What is the most out of the way place you can think of to store the private key on the system?

We have considered the registry but it doesn't work for the private key (has escape chars in it that do not store in a registry string).

Many regards,

TW3
0
Comment
Question by:twhite333
  • 9
  • 5
  • 3
19 Comments
 
LVL 12

Expert Comment

by:trywaredk
ID: 10796485
Why not use a share on your server, only with Read access ??

Understanding NTFS permissions:
http://www.windowsitlibrary.com/Content/592/1.html

Share Names With a "$" Character at the End Are Hidden
http://support.microsoft.com/default.aspx?scid=kb;en-us;90929

You Cannot Access Shared Files and Folders or Browse Computers in the Workgroup
http://support.microsoft.com/default.aspx?scid=kb;en-us;318030

Default Permissions for Shared Folders Is Read-Only Access for Everyone
http://support.microsoft.com/default.aspx?scid=kb;en-us;328065

Shared Folder Name Does Not Appear on Mapped Network Drive in Windows Explorer
http://support.microsoft.com/default.aspx?scid=kb;en-us;817861

Many Regards
Jorgen Malmgren
IT-Supervisor
Denmark

:o) Your brain is like a parachute. It works best when it's open
0
 
LVL 5

Expert Comment

by:Droby10
ID: 10796606
you can still use the registry and use a reg_binary field type rather than string.

is your app a service that is running 24/7 or a user/event driven application?  the reason i ask is because if it's a service, then you might want to opt for external storage of the key (pendrive, floppy, cd, etc.) once the service app is up and running with the private key already loaded into memory, remove the storage unit and keep it in an accessible but secure safe.

0
 
LVL 1

Author Comment

by:twhite333
ID: 10796949
I like your idea, trywaredk.  In fact, I can see other applications for that, too.  And droby is right about the reg_binary thing.  I just tried it and it worked.  But, since trywaredk's answer had broader application for us, I think I am going to give that a try.

Many thanks.  This site and the people on it have really helped us out a lot.  We are a tiny little company trying to do big things that are sometimes beyond our natural capability.  We sure do appreciate all the great ideas people have here.

Regards,

TW3
0
 
LVL 5

Expert Comment

by:Droby10
ID: 10796972
wow...not to complain, trywaredk usually comes up with some great links, but storing a private key "safely" was the original concern...and now you're considering putting it on a share?  that would be quite a remarkable move from out of the frying pan and into the fire, in light of your original concerns, and i can't say that this is the best advice given from the all-around-pro.  

read-only is a no-factor, because the entire point of securing private key data is to prevent people from reading it and thus compromising encrypted communications/data.  hidden shares aren't really hidden - you can still enumerate them without administrative priviledge (the microsoft packaged utilities for doing so simply filter them).

0
 
LVL 12

Expert Comment

by:trywaredk
ID: 10800389
DROBY10 ..."is to prevent people from reading it"

TWHITE333 asked:
1) "We use RSA within our app to encrypt/decrypt sensitive info"
2) "The app has to have access to the private key to perform these operations"

1)
If the app must read the private key in order to do an encryption/decryption, how should it be possible to hide the key in registry ?

Inserting it as binary doesn't encrypt it !

Text-to-Binary (and back!) Converter
http://www.sitinthecorner.com/binary/binary.php

2) You have to have it readable somewhere
0
 
LVL 12

Expert Comment

by:trywaredk
ID: 10800391
TWHITE333 --->  :o) Glad I could help you - thank you for the points
0
 
LVL 5

Assisted Solution

by:Droby10
Droby10 earned 125 total points
ID: 10800926
good job on the idea - it seems to meet his functional needs, thus the points, despite the backwards movement in securing the key by opening it up for ANYONE to read.  this is like saying, i keep my money tacked to the outside of my neighbor's front door because it's accessible to me.

reading it from the local registry (REG_BINARY, not for encryption, but because that's what's needed, functionally, as opposed to REG_SZ) does not transfer the key accross the network for anyone/everyone to read (as would be the case in smb/cifs/file sharing), and it does not (if adequately protected) put the key in a position to be read by anyone but the application (disable the remote registry service, lock down the permissions of the hive segment that pertains to the key to the applicable (user(s)/groups).

that said, you could encrypt the key file with aes (which there was no previous mention of).  then, at least, the transferal of the key file via smb/cifs will be encrypted as well.  the only caveat is that you may have multiple user's who legitimately need access to this file as part of "the application" (thus requiring an impersonated share)...and you are still putting it in a position to be compromised with far less work (more typing than it's worth).  points assigned, i'm not looking for a revocation (i could care less about the points), and i really don't want to argue, i just wanted twhite333 to know what exactly he was getting into, with such a concept.
0
 
LVL 1

Author Comment

by:twhite333
ID: 10801200
hmmm...   lemme think here.... What do you guys think about this?

Assuming the worse case scenario (someone has unfettered access to the system(s)), there is nothing that can be done to totally protect the sensitive stuff.  So, our goal at that point is to slow them down as much as possible so that their intrusion is given the greatest chance of being caught before they make it too far.

So, assuming a worse case scenario (hacker with unfettered access), our goal is to slow down access to these items as much as possible.  We know we can put things in the registry and read them easily enough.  If we name them something non-mnemonic their importance is not not easily identified just by looking at them.  And, if we encrypt them, then at least they have some work to do to get at them even if they identify their importance.

However, all this is moot if they do one thing - get at the application code.  The code would necessarily spell out the storage medium (no matter what it was), the location, naming, decryption method, etc.  So, actually, this then becomes our weakest link in the chain (sort of - the complexity of the code is in our favor - 100,000 lines of code that do not make it obvious how any of this is done).

Compilation of the code does slow the hacker's process down.  After that, we may very well be back at some version of trywaredk's suggestion so we can try to hide the key code elements as much as possible and continue to slow the progess of the intrusion.

Ultimately, though, I think that we are going to have to devise an application architecture that helps us here.  The more I think about it, trywaredk's idea is only good short term.  Ultimately, we will need to take this further using a better app architecture and HW infrastructure to help us out.  But, I think these combination of ideas may be our best short term solution.

Any thoughts?

TW3

PS:  on the issue of points, I may have been a little quick on the draw and would look to advice from others on the appropriate etiquette in this situation.  I am new and if a mistake was made then I will do what I am supposed to do to rectify it.  I do believe that your combined suggestions were useful for this problem.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 12

Expert Comment

by:trywaredk
ID: 10801985
>"on the issue of points, I may have been a little quick on the draw"

http://www.experts-exchange.com/Security/Win_Security/help.jsp#hi79

Post a 0 points question in http://www.experts-exchange.com/Community_Support/ with a title like
Moderator - please refund points and open the question again
and in the comments tell why, and a link to http://www.experts-exchange.com/Security/Win_Security/Q_20948839.html

0
 
LVL 12

Expert Comment

by:trywaredk
ID: 10801998
DROBY10..."and i really don't want to argue"

:o) Neither do I - We are all getting better, when we comments on issues, and I'm very interested in reading other experts arguments.

BTW: It's not allowed according to http://www.experts-exchange.com/memberAgreement.jsp)

0
 
LVL 12

Accepted Solution

by:
trywaredk earned 125 total points
ID: 10802073
TWHITE333..."if we encrypt them, then at least they have some work to do to get at them even if they identify their importance"

Well - After reading yours and DROBY10's comments, I did a new research on the issue.

:o) And now you maybe want to split points between DROBY10 and me:

DROBY10..." you could encrypt the key file with aes"

No (it's actually EFS http://support.microsoft.com/default.aspx?scid=kb;en-us;230520). At this point DROBY10 is commenting on my "solution" above with FILES

Instead you should use DPAPI to encrypt the private key in registry. At this point I'm commenting on DROBY10's "solution" above with registry

Here's the solution:

Troubleshooting the Data Protection API (DPAPI)
http://support.microsoft.com/default.aspx?kbid=309408#2

***quote***
The private key that is associated with the certificate is encrypted by DPAPI and saved (in an encrypted form) in a key container as an individual file in the user's profile in the following folders:
For RSA Keys:
%Userprofile%\Application Data\Microsoft\Crypto\RSA\User SID
***end of quote***

High Encryption Pack Does Not Protect Windows 2000 Private Keys
http://support.microsoft.com/default.aspx?scid=kb;en-us;260219&sd=tech
0
 
LVL 5

Expert Comment

by:Droby10
ID: 10803060
actually, i was making a specific point of using aes, which is the defacto default algorythm for efs (since xp sp1), rather than the weaker alternative schemes available within efs.

but, you deserve the points for the dpapi solution.  that's the most appropriate answer thus far as it's designed specifically for this kind of scenario.  very nice answer.

0
 
LVL 12

Expert Comment

by:trywaredk
ID: 10805655
DROBY10..."rather than the weaker alternative schemes available within efs"

:o) You're quite right, because I forgot to study the notes before answering above:

***quote***
NOTES:
Windows 2000 can only use the expanded Data Encryption Standard (DESX) algorithm for EFS encryption and decryption.
Versions of Windows XP earlier than SP1 can only use the expanded DESX or the Triple-DES (3DES) algorithm for EFS encryption and decryption.
Windows XP with SP1 or later can encrypt or decrypt files using DESX, 3DES, or AES.
***end of quote***
0
 
LVL 12

Expert Comment

by:trywaredk
ID: 10805671
LOL - and I also forgot the link to the notes in my quote
http://support.microsoft.com/default.aspx?scid=kb;en-us;329741&sd=tech
0
 
LVL 1

Author Comment

by:twhite333
ID: 10806872
ok - After some thought, I decided to increase and then split the points.  I increased the points because I think it was more involved than I thought it might be in the beginning.  I split the points for obvious reasons - it was a combined effort that evolved based on numerous comments.

I appreciate you two working together on this.  The outcome was a far better solution that I believe to be immenently workable.

Many regards,

TW3
0
 
LVL 12

Expert Comment

by:trywaredk
ID: 10808805
:o) Glad we could help you - thank you for the points

Modulo - Happy to see that we all agree about the issue: Helping the questioner, and not fighting with each other.

Many Regards
Jorgen Malmgren
IT-Supervisor
Denmark

:o) Your brain is like a parachute. It works best when it's open


0
 
LVL 5

Expert Comment

by:Droby10
ID: 10809428
looks like we're all in agreement - nice job everyone!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
Security measures require Windows be logged in using Standard User login (not Administrator).  Yet, sometimes an application has to be run “As Administrator” from a Standard User login.  This paper describes how to create a shortcut icon to launch a…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now