public static bool VerifySignature(IEcPublicKey signingKey, byte[] message, byte[] signature) { if (signingKey.GetKeyType() == DjbType) { return(Curve25519.GetInstance(Curve25519ProviderType.Best) .VerifySignature(((DjbEcPublicKey)signingKey).GetPublicKey(), message, signature)); } else { throw new InvalidKeyException("Unknown type: " + signingKey.GetKeyType()); } }
public static byte[] CalculateAgreement(IEcPublicKey publicKey, IEcPrivateKey privateKey) { if (publicKey.GetKeyType() != privateKey.GetKeyType()) { throw new InvalidKeyException("Public and private keys must be of the same type!"); } if (publicKey.GetKeyType() == DjbType) { return(Curve25519.GetInstance(Curve25519ProviderType.Best) .CalculateAgreement(((DjbEcPublicKey)publicKey).GetPublicKey(), ((DjbEcPrivateKey)privateKey).GetPrivateKey())); } else { throw new InvalidKeyException("Unknown type: " + publicKey.GetKeyType()); } }