guides/java/crypto/BC25519.java
public static void main(String args[]){

		if( args.length < 1 ){
			System.out.println("Please specify operation <gen|sign|verify>");
			System.exit(1);
		}

		if( args[0].equals("gen") ){
			//generate public key
			generateKeyPair("public","secret");
		}else if(args[0].equals("sign")){
			//test sign a message
			byte[] s = signMessage( "secret", "Hello World" );

			StringBuilder sb = new StringBuilder();
			for (byte b : s) {
				sb.append(String.format("%02x", b));
			}
			System.out.println(sb.toString());

		}else if(args[0].equals("verify")){

			if( verifyMessage( "public", "signature", "Hello World") == 0){
				//signature verified
				System.out.println("OK");
			}else{
				//signature failed to verify
				System.out.println("FAIL");
			}

		}

		System.exit(0);
	}
/*
	 * Test driver function (Main)
	 */
Test driver function (Main)
Test driver function ( Main )
public static void main(String args[]){
		if( args.length < 1 ){
			System.out.println("Please specify operation <gen|sign|verify>");
			System.exit(1);
		}
		if( args[0].equals("gen") ){
			generateKeyPair("public","secret");
		}else if(args[0].equals("sign")){
			byte[] s = signMessage( "secret", "Hello World" );
			StringBuilder sb = new StringBuilder();
			for (byte b : s) {
				sb.append(String.format("%02x", b));
			}
			System.out.println(sb.toString());
		}else if(args[0].equals("verify")){
			if( verifyMessage( "public", "signature", "Hello World") == 0){
				System.out.println("OK");
			}else{
				System.out.println("FAIL");
			}
		}
		System.exit(0);
	}
public static void main ( String args [ ] ) { if ( args . length < 1 ) { System . out . println ( "Please specify operation <gen|sign|verify>" ) ; System . exit ( 1 ) ; } if ( args [ 0 ] . equals ( "gen" ) ) { generateKeyPair ( "public" , "secret" ) ; } else if ( args [ 0 ] . equals ( "sign" ) ) { byte [ ] s = signMessage ( "secret" , "Hello World" ) ; StringBuilder sb = new StringBuilder ( ) ; for ( byte b : s ) { sb . append ( String . format ( "%02x" , b ) ) ; } System . out . println ( sb . toString ( ) ) ; } else if ( args [ 0 ] . equals ( "verify" ) ) { if ( verifyMessage ( "public" , "signature" , "Hello World" ) == 0 ) { System . out . println ( "OK" ) ; } else { System . out . println ( "FAIL" ) ; } } System . exit ( 0 ) ; }
Test driver function (Main)
Test driver function ( Main )
//generate public key //test sign a message //signature verified //signature failed to verify