/**
* @param args
*/
public static void main(String[] args) throws Exception {
Curves curve = ECDSA.Curves.P256;
ECDSA ecdsa = new ECDSA(curve);
String toSign = "test";
byte[] signedBytes = toSign.getBytes("utf-8");
//byte[] sig = ecdsa.sign(signedBytes);
byte[] sig = ecdsa.signToNetworkFormat(signedBytes);
System.out.println("Curve in use : " + curve.toString());
System.out.println(ecdsa.getPublicKey().toString());
System.out.println("ToSign : "+toSign + " ("+toHex(signedBytes)+")");
System.out.println("Signature: "+ toHex(sig));
System.out.println("Verify? : "+ecdsa.verify(sig, signedBytes));
SimpleFieldSet sfs = ecdsa.asFieldSet(true);
System.out.println("\nSerialized to: ");
System.out.println(sfs.toString());
System.out.println("Restored to: ");
ECDSA ecdsa2 = new ECDSA(sfs.getSubset(curve.name()), curve);
System.out.println(ecdsa2.getPublicKey());
System.out.println("Verify? : "+ecdsa2.verify(sig, signedBytes));
System.out.println("Let's ensure that the signature always fits into "+ecdsa.curve.maxSigSize+" bytes.");
int max = 0;