예제 #1
0
 public static byte[] Create(byte[] message, byte[] recipientPublicKey)
 {
     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[message.Length + 48];
     if (SodiumLibrary.crypto_box_seal(array, message, (long)message.Length, recipientPublicKey) != 0)
     {
         throw new CryptographicException("Failed to create SealedBox");
     }
     return(array);
 }