/**
* where to find .keystore
*/
private static final String KEYSTORE_FILENAME =
"C:/users/roedy/.keystore";
...
final KeyStore keystore = KeyStore.getInstance( "JKS" );
keystore.load( new FileInputStream( KEYSTORE_FILENAME ), null
);
return ( PrivateKey ) keystore.getKey(
RECEIVERS_PRIVATE_CERTIFICATE_ALIAS, PASSWORD );
Is there a way to just get the default .keystore without having to
guess where it is on disk?
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
> I currently have some code like this:
>
> /**
> * where to find .keystore
> */
> private static final String KEYSTORE_FILENAME =
> "C:/users/roedy/.keystore";
>
>
> ....
>
> final KeyStore keystore = KeyStore.getInstance( "JKS" );
> keystore.load( new FileInputStream( KEYSTORE_FILENAME ), null
> );
> return ( PrivateKey ) keystore.getKey(
> RECEIVERS_PRIVATE_CERTIFICATE_ALIAS, PASSWORD );
>
>
> Is there a way to just get the default .keystore without having to
> guess where it is on disk?
>
[1] says about user-level certificates:
>The default locations of the of the keystore files for Unix and Windows are as follows:
>
>Operating System Location
>Unix ${user.home}/.java/deployment/security.
>Windows ${deployment.user.home}\security
So you can access those through the system properties.
There's the location of system-wide certs just below in that document. I
hope this applies - the user.home would be one of the place to search,
definately, though.
[1]
<http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/jcp.html>
--
Sabine Dinis Blochberger
Op3racional
www.op3racional.eu
>>Unix ${user.home}/.java/deployment/security.
>>Windows ${deployment.user.home}\security
I wonder what they mean by that? There is no deployment.user.home
property.
On Jet there is:
user.home = C:\Users\roedy\AppData\Roaming\Microsoft\Windows
on Java.exe there is
user.home = C:\Users\roedy
user.dir seems to point to the cwd.
they say to look in C:\Docments and Settings\jsmith\Application
Data\Sun\Java\Deployment\security
for XP.
They also point out that Java does not create .keystore. The sysadmin
might put it anywhere, and might disguise it with any name.
possible directories on Vista include:
C:\Program Files\Java\jre1.6.0_06\lib\security
C:\Users\roedy\AppData\LocalLow\Sun\Java\Deployment\security
C:\Users\roedy\AppData\Roaming\Sun\Java\Deployment\security
I have summarised what I have discovered at
http://mindprod.com/jgloss/keystore.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
---
> On Tue, 08 Jul 2008 10:24:42 +0100, Sabine Dinis Blochberger
> <no....@here.invalid> wrote, quoted or indirectly quoted someone who
> said :
>
> >>Unix ${user.home}/.java/deployment/security.
> >>Windows ${deployment.user.home}\security
>
> I wonder what they mean by that? There is no deployment.user.home
> property.
>
Yes, that's why I wondered if this applied at all (user.home does I
think) - the document I found is about deploying...
> On Jet there is:
> user.home = C:\Users\roedy\AppData\Roaming\Microsoft\Windows
>
> on Java.exe there is
> user.home = C:\Users\roedy
>
> user.dir seems to point to the cwd.
>
> they say to look in C:\Docments and Settings\jsmith\Application
> Data\Sun\Java\Deployment\security
> for XP.
>
> They also point out that Java does not create .keystore. The sysadmin
> might put it anywhere, and might disguise it with any name.
>
Yes. IIRC, installing the JRE or JDK does not create any keystore. I
suppose you will always need to ask the user about it...
> possible directories on Vista include:
> C:\Program Files\Java\jre1.6.0_06\lib\security
> C:\Users\roedy\AppData\LocalLow\Sun\Java\Deployment\security
> C:\Users\roedy\AppData\Roaming\Sun\Java\Deployment\security
>
> I have summarised what I have discovered at
> http://mindprod.com/jgloss/keystore.html
>
Great! :)