public static ECKeyPair generateKeyPair() { Curve25519KeyPair keyPair = Curve25519.getInstance(BEST).generateKeyPair(); return(new ECKeyPair(new DjbECPublicKey(keyPair.getPublicKey()), new DjbECPrivateKey(keyPair.getPrivateKey()))); }
public static Curve25519 getInstance(int test) { if (instance == null) { instance = new Curve25519(); } return instance; }
public static Curve25519 getInstance(int test) { if (instance == null) { instance = new Curve25519(); } return(instance); }
/// <summary> /// Accesses the currently in use Curve25519 provider, according to the type requested. /// </summary> /// <param name="type">Type of provider requested.</param> /// <returns>Provider</returns> public static Curve25519 getInstance(Curve25519ProviderType type) { if (instance == null) { instance = new Curve25519(); instance.provider = (ICurve25519Provider) new Curve25519NativeProvider(); } return(instance); }
/// <summary> /// Accesses the currently in use Curve25519 provider, according to the type requested. /// </summary> /// <param name="type">Type of provider requested.</param> /// <returns>Provider</returns> public static Curve25519 getInstance(Curve25519ProviderType type) { if (instance == null) { instance = new Curve25519(); instance.provider = (ICurve25519Provider)new Curve25519NativeProvider(); } return instance; }
public static byte[] calculateSignature(ECPrivateKey signingKey, byte[] message) { if (signingKey.getType() == DJB_TYPE) { return(Curve25519.getInstance(BEST) .calculateSignature(((DjbECPrivateKey)signingKey).getPrivateKey(), message)); } else { throw new InvalidKeyException("Unknown type: " + signingKey.getType()); } }
public static bool verifySignature(ECPublicKey signingKey, byte[] message, byte[] signature) { if (signingKey.getType() == DJB_TYPE) { return(Curve25519.getInstance(BEST) .verifySignature(((DjbECPublicKey)signingKey).getPublicKey(), message, signature)); } else { throw new InvalidKeyException("Unknown type: " + signingKey.getType()); } }
public static byte[] calculateAgreement(ECPublicKey publicKey, ECPrivateKey privateKey) { if (publicKey.getType() != privateKey.getType()) { throw new InvalidKeyException("Public and private keys must be of the same type!"); } if (publicKey.getType() == DJB_TYPE) { return(Curve25519.getInstance(BEST) .calculateAgreement(((DjbECPublicKey)publicKey).getPublicKey(), ((DjbECPrivateKey)privateKey).getPrivateKey())); } else { throw new InvalidKeyException("Unknown type: " + publicKey.getType()); } }
public static bool isNative() { return(Curve25519.getInstance(BEST).isNative()); }
public static bool isNative() { return(Curve25519.getInstance(Curve25519ProviderType.BEST).isNative()); }