11.07.2015 Views

Borland VisiBroker® 7.0 - Borland Technical Publications

Borland VisiBroker® 7.0 - Borland Technical Publications

Borland VisiBroker® 7.0 - Borland Technical Publications

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Steps to secure clients and serversUsername/password authentication, using APIsThe following code sample demonstrates the use of the login APIs. This case uses awallet. For a full description of the four login modes supported, go to the VisiSecure forJava API and SPI sections.public static void main(String[] args) {//initialize the ORBorg.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);com.borland.security.Context ctx = (com.borland.security.Context)orb.resolve_initial_references("VBSecurityContext");if(ctx != null) {com.borland.securty.IdentityWallet wallet =new com.borland.security.IdentityWallet(,.toCharArray(), );ctx.login(wallet);}}Certificate-based authentication, using KeyStores through propertysettingsBy setting the property vbroker.security.login.realms=Certificate#ALL, the client willbe prompted for keystore location and access information. For valid values, see“Certificate mechanism” on page 38.Certificate-based authentication, using KeyStores through APIsYou can use the same APIs discussed in ““Username/password authentication, usingAPIs” on page 67” to login using certificates through KeyStores. The realm name in theIdentityWallet should be CERTIFICATE#ALL, the username corresponds to an alias name inthe default KeyStore that refers to a Key entry, and the password refers to the PrivateKey password (also the KeyStore password) corresponding to the same Key entry.Certificate-based authentication, using APIsIf you do not want to use KeyStores directly, you can specify certificates and privatekeys using the CertificateWalletAPI. This class also supports the pkcs12 file format.X509Certificate[] certChain = ...list-of-X509-certificates...PrivateKey privKey = private-keycom.borland.security.CertificateWallet wallet =new com.borland.security.CertificateWallet(alias,certChain, privKey, "password".toCharArray());The first argument in the new Certificate wallet is an alias to the entry in the KeyStore,if any. If you are not using keystores, set this argument to null.pkcs12-based authentication, using KeyStoresYou can use the same APIs discussed in “Username/password authentication, usingAPIs” on page 67 to login using pkcs12 KeyStores. The realm name in theIdentityWallet should be CERTIFICATE#ALL, the username corresponds to an alias name inthe default KeyStore that refers to a Key entry, and the password refers to the passwordneeded to unlock the pkcs12 file. The property javax.net.ssl.KeyStore specifies thelocation of the pkcs12 file.pkcs12-based authentication, using APIsSee “Certificate-based authentication, using APIs” on page 67.Chapter 6: Making Secure Connections (Java) 67

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!