guides/java/crypto/BC25519.java
public static byte[] signMessage(String secret_filename, String message){
		Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
		try{
			//Create object from unencrypted private key
			//first remove the header lines
			String raw = obtainRaw(secret_filename,true);
			if( raw == null ){
				return null; //error
			}
			byte[] encoded = Base64.getDecoder().decode(raw);

			//CREATE PRIVATE KEY
			PKCS8EncodedKeySpec kspec = new PKCS8EncodedKeySpec(encoded);
			KeyFactory kf = KeyFactory.getInstance("Ed25519","BC");
			PrivateKey secret = kf.generatePrivate(kspec); //obtained the private key from file

			MessageDigest md = MessageDigest.getInstance("SHA-512");
			md.update( message.getBytes() ); //update with what we want to digest
			byte[] d = md.digest(); //perform the digest

			Signature sig = Signature.getInstance("Ed25519","BC"); //obtain a signature generator
			//sig.initSign(secret, new SecureRandom()); //intiailize signature (probabilistic)
			sig.initSign(secret); //intiailize signature
			sig.update(d); //update the digest to be signed
			byte[] out = sig.sign();

			return out;
		}catch( Exception e ){
			System.out.println(e);
			return null;
		}
	}
/*
	 * Takes in a message (string) and signs it with the secret
	 * signature is deterministic, using message digest SHA512
	 */
Takes in a message (string) and signs it with the secret
signature is deterministic, using message digest SHA512
Takes in a message ( string ) and signs it with the secret signature is deterministic using message digest SHA512
public static byte[] signMessage(String secret_filename, String message){
		Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
		try{
			String raw = obtainRaw(secret_filename,true);
			if( raw == null ){
				return null; 
			}
			byte[] encoded = Base64.getDecoder().decode(raw);
			PKCS8EncodedKeySpec kspec = new PKCS8EncodedKeySpec(encoded);
			KeyFactory kf = KeyFactory.getInstance("Ed25519","BC");
			PrivateKey secret = kf.generatePrivate(kspec); 
			MessageDigest md = MessageDigest.getInstance("SHA-512");
			md.update( message.getBytes() ); 
			byte[] d = md.digest(); 
			Signature sig = Signature.getInstance("Ed25519","BC"); 
			sig.initSign(secret); 
			sig.update(d); 
			byte[] out = sig.sign();
			return out;
		}catch( Exception e ){
			System.out.println(e);
			return null;
		}
	}
public static byte [ ] signMessage ( String secret_filename , String message ) { Security . addProvider ( new org . bouncycastle . jce . provider . BouncyCastleProvider ( ) ) ; try { String raw = obtainRaw ( secret_filename , true ) ; if ( raw == null ) { return null ; } byte [ ] encoded = Base64 . getDecoder ( ) . decode ( raw ) ; PKCS8EncodedKeySpec kspec = new PKCS8EncodedKeySpec ( encoded ) ; KeyFactory kf = KeyFactory . getInstance ( "Ed25519" , "BC" ) ; PrivateKey secret = kf . generatePrivate ( kspec ) ; MessageDigest md = MessageDigest . getInstance ( "SHA-512" ) ; md . update ( message . getBytes ( ) ) ; byte [ ] d = md . digest ( ) ; Signature sig = Signature . getInstance ( "Ed25519" , "BC" ) ; sig . initSign ( secret ) ; sig . update ( d ) ; byte [ ] out = sig . sign ( ) ; return out ; } catch ( Exception e ) { System . out . println ( e ) ; return null ; } }
Takes in a message (string) and signs it with the secret
 signature is deterministic, using message digest SHA512
Takes in a message ( string ) and signs it with the secret signature is deterministic using message digest SHA512
//Create object from unencrypted private key //first remove the header lines //error //CREATE PRIVATE KEY //obtained the private key from file //update with what we want to digest //perform the digest //obtain a signature generator //sig.initSign(secret, new SecureRandom()); //intiailize signature (probabilistic) //intiailize signature //update the digest to be signed