View UtilityFunctionBundle.properties
Setup the host names and then the certificates
services/air/sabre/connectors
PolarConnector.java

Technical notes, and other ideas.
View UtilityFunctionBundle.properties
Setup the host names and then the certificates
services/air/sabre/connectors
PolarConnector.java
Refer: http://www.10gen.com
Could not get Safenet working and kept getting the following error, one solution found was to explode the EAR file.
JCE cannot authenticate the provider IngrianProvider
Caused by: java.util.jar.JarException:
Cannot parse jar:file:/home/jboss1/programs/jboss-eap-5.1/jboss-as/server/haldev-vm-template-safenet/deploy/hal-ear-1.0-SNAPSHOT.ear!/hal-web-1.0-SNAPSHOT.war
Did not need to implement this solution but this is where the changes would go:
/usr/lib/jvm/java-1.6.0/jre/lib/security/java.security
security.provider.10=com.ingrian.security.nae.IngrianProvider
Where you specify the properties file in JBoss:
/home/jboss1/programs/jboss-eap-5.1/jboss-as/server/haldev-vm-template/deploy/properties-service.xml
In the template you need to also have the properties file itself:
./conf/props/IngrianNAE.properties
Set the system property in the application:
System.setProperty(
"com.ingrian.security.nae.IngrianNAE_Properties_Conf_Filename",
"home/java/IngrianNAE.properties");
The following code stub can be used to encrypt/decrypt with the Safenet appliance. Refer: CryptoTool.java
private static String doEncrypt( final String plainText ) throws Exception
{
NAESession naesession = NAESession.getSession( "mlrtest", "asdf1234" );
SecretKey secretkey = NAEKey.getSecretKey( "test128", naesession );
Cipher cipher =
Cipher.getInstance( "AES/CBC/PKCS5Padding", "IngrianProvider" );
byte [] iv = new byte [16];
String ivString = "1234567890123456";
iv = ivString.getBytes();
cipher.init( Cipher.ENCRYPT_MODE, secretkey, new IvParameterSpec( iv ) );
byte [] outputByteArray = cipher.doFinal( plainText.getBytes() );
return IngrianProvider.byteArray2Hex( outputByteArray );
}
private static String doDecrypt( final String encryptedText )
throws Exception
{
NAESession naesession = NAESession.getSession( "mlrtest", "asdf1234" );
SecretKey secretkey = NAEKey.getSecretKey( "test128", naesession );
Cipher cipher =
Cipher.getInstance( "AES/CBC/PKCS5Padding", "IngrianProvider" );
byte [] iv = new byte [16];
String ivString = "1234567890123456";
iv = ivString.getBytes();
cipher.init( Cipher.DECRYPT_MODE, secretkey, new IvParameterSpec( iv ) );
byte [] decryptedByte =
cipher.doFinal( IngrianProvider.hex2ByteArray( encryptedText ) );
String decrypted = new String( decryptedByte );
return decrypted;
}
Insert the following line in your Java code:
System.out.println(new File(".").getAbsolutePath());
Refer: 20120512 Using Third-party jars with Maven
To use third party jars in a maven project, the steps are as follows:
1) Upload the jar into a repository (either your local repository if it's just for you, or into the shared Nexus repository if you want other people to access the jar as well)
2) Add a section in your pom.xml to tell maven that your application depends on this jar.
Here are the commands to implement those steps:
To upload a jar in your local repository (your local repository is on your vm in ~/.m2/repository):
mvn install:install-file
-Dfile= -DgroupId=com.hal.thirdparty
-DartifactId=
-Dversion=
-Dpackaging= -DgeneratePom=true
Where: the path to the file to load
the group that the file should be registered under
the artifact name for the file
the version of the file
the packaging of the file e.g. jar
To upload a jar into the shared Nexus Repository:
Option A: Command line
mvn deploy:deploy-file -Durl=file://C:m2-repo
-DrepositoryId=some.id
-Dfile=your-artifact-1.0.jar
[-DpomFile=your-pom.xml]
[-DgroupId=org.some.group]
[-DartifactId=your-artifact]
[-Dversion=1.0]
[-Dpackaging=jar]
[-Dclassifier=test]
[-DgeneratePom=true]
[-DgeneratePom.description="My Project Description"]
[-DrepositoryLayout=legacy]
[-DuniqueVersion=false]
See here for the detail of the options: http://maven.apache.org/plugins/maven-deploy-plugin/usage.html
Option B: Using the web interface from Nexus at http://halsvn01:8081/nexus/index.html#view-repositories;thirdparty~uploadPanel
See the attached screenshot.
In both options, you will need Nexus admin credentials to upload artifacts (jars in maven terms) into the shared repository.
2) In your pom.xml, inside the section, add:
com.hal.thirdparty
your-artifact
your-artifact-version
-------------------------------------
Guillaume Radde
Senior Consultant, Red Hat Consulting
guillaume.radde@redhat.com
http://www.redhat.com
-------------------------------------
The following will remove it from the dropdown list when your startup Eclipse. Eclipse is not very happy if it thinks there's supposed to be a workspace but it's not there.
Window,Preferences,General,"Startup and Shutdown",Workspaces
From there you can delete a workspace you are no longer using, and then delete if from your drive
/hal-parent/hal-ejb/src/main/java/com/hollandamerica/common/encryption/WebKeyFactory.java
Refer: http://stackoverflow.com/questions/150167/how-do-i-list-export-private-keys-from-a-keystore
import org.apache.axis.encoding.Base64;
//NOTE: DO NOT MIGRATE THIS CODE!!!
System.out.println("ifw.getPassword()"+ifw.getPassword().toString());
decryptionKey = (RSAPrivateKey)newKeyStore.getKey(
Keystore.END_ENTITY_ALIAS,ifw.getPassword());
System.out.println("maurice:decryptionKey"+decryptionKey.toString());
//String b64 = new BASE64Encoder().encode(key.getEncoded());
String b64 = new String(Base64.encode(decryptionKey.getEncoded()));
System.out.println("-----BEGIN PRIVATE KEY-----");
System.out.println(b64);
System.out.println("-----END PRIVATE KEY-----");