EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Certifcate Storage with Java Edition

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#21284
Posted: 08/30/2012 17:42:34
by Daniel Medina (Standard support level)
Joined: 06/21/2011
Posts: 20

Hi,

I'm been using SBB for .Net for a while, but now I need to use the Java version for a small project.

In .Net I could use a TElWinCertStorage to access the Windows Certificate Store or I could use (in some cases) the TElX509Certificate.FromX509Certificate2() method.

Is there anything similar in the Java version? Or How could I encrypt a file in PKCS#7 format within Java using a HSM?

Thanks
#21286
Posted: 08/30/2012 23:48:55
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Java edition is compiled from the same source code as .NET edition, so you can use all functionality the same way. One major difference is that in Java both functions you are asking about are implemented via JNI.

TElX509Certificate.FromX509Certificate2() is not available because its only for .NET, but if you need to convert java.security.cert.X509Certificate to TElX509Certificate this can be done in a few lines of code.
#21293
Posted: 08/31/2012 09:19:29
by Daniel Medina (Standard support level)
Joined: 06/21/2011
Posts: 20

Can you please give me an example code of this?

Thank you very much!!
#21294
Posted: 08/31/2012 09:29:40
by Eugene Mayevski (EldoS Corp.)

TElWinCertStorage is present in SecureBlackbox 10 only. Samples which include its use are in the works now. You can use .NET samples as they offer the same API.


Sincerely yours
Eugene Mayevski
#21295
Posted: 08/31/2012 09:31:21
by Vsevolod Ievgiienko (EldoS Corp.)

A simple TElWinCertStorage sample can be found in \secbboxjava\Samples\PKIBlackbox\JNI folder.

A sample for PKCS#7 is located in \secbboxjava\Samples\PKIBlackbox\MessagesDemo.

A sample for PKCS#11 is not included into the current build, but I'll send it to you via Helpdesk.

We don't have a sample that demonstrates how to "encrypt a file in PKCS#7 format within Java using a HSM" but you can simply combine MessagesDemo and a sample I'll send you.
#21307
Posted: 09/04/2012 17:10:40
by Daniel Medina (Standard support level)
Joined: 06/21/2011
Posts: 20

And is there an example of how to convert a java.security.cert.X509Certificate to a TElX509Certificate?
#21308
Posted: 09/05/2012 01:29:13
by Vsevolod Ievgiienko (EldoS Corp.)

We don't have such sample but this can be done simply. You should save java.security.cert.X509Certificate using its getEncoded() method and then you can load saved buffer using TElX509Certificate.LoadFromBuffer method.

You can also use an utility method from our JCE crypto provider that is located in SecureBlackbox.JCE.jar: SecureBlackbox.jce.provider.cert.ElX509Certificate.toSBBFormat():
Code
static public TElX509Certificate toSBBFormat(Certificate cert) {
        try
        {
            TElX509Certificate res = new TElX509Certificate();
            res.LoadFromBuffer(cert.getEncoded());
        
            return res;
        }
        catch (CertificateEncodingException ex)
        {
            return null;
        }
    }
#21326
Posted: 09/06/2012 10:35:12
by Daniel Medina (Standard support level)
Joined: 06/21/2011
Posts: 20

Hi,

I have another question since there is almost no Java documentation.

Can you give an example of use of this method TElWinCertStorage.GetAvailableStores()


Thanks
#21328
Posted: 09/06/2012 10:51:41
by Vsevolod Ievgiienko (EldoS Corp.)

Hello.

Due to some Pascal-to-Java compiler restrictions this code looks a little bit strange:
Code
TElStringList List = new TElStringList();
TElWinCertStorage.GetAvailableStores(TElWinCertStorage.class, List, TSBStorageAccessType.atCurrentUser);
#21329
Posted: 09/06/2012 10:59:54
by Daniel Medina (Standard support level)
Joined: 06/21/2011
Posts: 20

Thank u very much
Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.

Reply

Statistics

Topic viewed 2869 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!