public static byte[] calculateSignature(ECPrivateKey signingKey, byte[] message) { if (signingKey.getType() == DJB_TYPE) { return(Curve25519.getInstance(Curve25519ProviderType.BEST) .calculateSignature(((DjbECPrivateKey)signingKey).getPrivateKey(), message)); } else { throw new InvalidKeyException("Unknown type: " + signingKey.getType()); } }
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 byte[] calculateAgreement(ECPublicKey publicKey, ECPrivateKey privateKey) { if (publicKey == null) { throw new InvalidKeyException("public value is null"); } if (privateKey == null) { throw new InvalidKeyException("private value is null"); } 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(Curve25519ProviderType.BEST) .calculateAgreement(((DjbECPublicKey)publicKey).getPublicKey(), ((DjbECPrivateKey)privateKey).getPrivateKey())); } else { throw new InvalidKeyException("Unknown type: " + publicKey.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(Curve25519ProviderType.BEST) .calculateAgreement(((DjbECPublicKey)publicKey).getPublicKey(), ((DjbECPrivateKey)privateKey).getPrivateKey()); } else { throw new InvalidKeyException("Unknown type: " + publicKey.getType()); } }