public static byte[] Open(byte[] cipherText, byte[] recipientSecretKey, byte[] recipientPublicKey) { if (recipientSecretKey == null || recipientSecretKey.Length != 32) { throw new KeyOutOfRangeException("recipientPublicKey", (recipientSecretKey == null) ? 0 : recipientSecretKey.Length, string.Format("recipientSecretKey must be {0} bytes in length.", 32)); } if (recipientPublicKey == null || recipientPublicKey.Length != 32) { throw new KeyOutOfRangeException("recipientPublicKey", (recipientPublicKey == null) ? 0 : recipientPublicKey.Length, string.Format("recipientPublicKey must be {0} bytes in length.", 32)); } byte[] array = new byte[cipherText.Length - 48]; if (SodiumLibrary.crypto_box_seal_open(array, cipherText, (long)cipherText.Length, recipientPublicKey, recipientSecretKey) != 0) { throw new CryptographicException("Failed to open SealedBox"); } return(array); }