Java tutorial
package com.floreantpos.license; import java.io.FileOutputStream; import java.io.IOException; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import org.apache.commons.io.IOUtils; public class FiveStarPOSKeyGenerator { public static void createKeys(String publicKeyUri, String privateKeyUri) throws NoSuchAlgorithmException, IOException { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA"); keyGen.initialize(1024, new SecureRandom()); KeyPair keyPair = keyGen.generateKeyPair(); IOUtils.write(keyPair.getPublic().getEncoded(), new FileOutputStream(publicKeyUri)); IOUtils.write(keyPair.getPrivate().getEncoded(), new FileOutputStream(privateKeyUri)); } }