Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / January 2004

Tip: Looking for answers? Try searching our database.

OpenLdap and userPKCS12

Thread view: 
J. Cavanaugh - 08 Jan 2004 21:41 GMT
Has anyone had success storing and retrieving a PKCS12 keystore in OpenLDAP?
I store the keystore in a ByteArrayOutputStream, then store the bytes in
OpenLDAP. The bytes get stored, but as a string. When I retrieve the string,
it's almost right, but any negative bytes have been replaced with decimal
63. Here's a snippet of the store:

   KeyStore ks = ...
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   ks.store(baos, keystorePassphrase.toCharArray());
   Attribute newattr = new BasicAttribute(pkcs12Name, baos.toByteArray());
   attrs.put(newattr);
   ctx.modifyAttributes(dn, DirContext.ADD_ATTRIBUTE, attrs);

Here's the retrieval:

   Attribute attr = attrs.get(pkcs12Name);
   String o = (String)attr.get();
   byte[] bytes = (byte[]) o.getBytes();

   ByteArrayInputStreambais = new ByteArrayInputStream(bytes);
   KeyStore ks = KeyStore.getInstance("PKCS12", "BC");
   ks.load(bais, keystorePassphrase.toCharArray());
jmc - 30 Jan 2004 14:05 GMT
Never mind - we figured it out.

> Has anyone had success storing and retrieving a PKCS12 keystore in OpenLDAP?
> I store the keystore in a ByteArrayOutputStream, then store the bytes in
[quoted text clipped - 18 lines]
>     KeyStore ks = KeyStore.getInstance("PKCS12", "BC");
>     ks.load(bais, keystorePassphrase.toCharArray());


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.