org.whispersystems.curve25519.OpportunisticCurve25519Provider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of curve25519-java Show documentation
Show all versions of curve25519-java Show documentation
Curve25519 library for Java
package org.whispersystems.curve25519;
public class OpportunisticCurve25519Provider implements Curve25519Provider {
private Curve25519Provider delegate;
OpportunisticCurve25519Provider() {
try {
delegate = new NativeCurve25519Provider();
} catch (NoSuchProviderException e) {
delegate = new JavaCurve25519Provider();
}
}
@Override
public boolean isNative() {
return delegate.isNative();
}
@Override
public byte[] calculateAgreement(byte[] ourPrivate, byte[] theirPublic) {
return delegate.calculateAgreement(ourPrivate, theirPublic);
}
@Override
public byte[] generatePublicKey(byte[] privateKey) {
return delegate.generatePublicKey(privateKey);
}
@Override
public byte[] generatePrivateKey() {
return delegate.generatePrivateKey();
}
@Override
public byte[] generatePrivateKey(byte[] random) {
return delegate.generatePrivateKey(random);
}
@Override
public byte[] getRandom(int length) {
return delegate.getRandom(length);
}
@Override
public void setRandomProvider(SecureRandomProvider provider) {
delegate.setRandomProvider(provider);
}
@Override
public byte[] calculateSignature(byte[] random, byte[] privateKey, byte[] message) {
return delegate.calculateSignature(random, privateKey, message);
}
@Override
public boolean verifySignature(byte[] publicKey, byte[] message, byte[] signature) {
return delegate.verifySignature(publicKey, message, signature);
}
}