public static byte[] ConvertEd25519PublicKeyToCurve25519PublicKey(byte[] ed25519PublicKey) { if (ed25519PublicKey == null || ed25519PublicKey.Length != 32) { throw new KeyOutOfRangeException("ed25519PublicKey", (ed25519PublicKey == null) ? 0 : ed25519PublicKey.Length, string.Format("ed25519PublicKey must be {0} bytes in length.", 32)); } byte[] array = new byte[32]; if (SodiumLibrary.crypto_sign_ed25519_pk_to_curve25519(array, ed25519PublicKey) != 0) { throw new CryptographicException("Failed to convert public key."); } return(array); }