Public Key Cryptography _Sealed Boxes - Chewhern/ASodium GitHub Wiki
For detail documentation, kindly refer to official libsodium.
Sealed box is a very fascinating idea at the least to me. People complain that when implementing RSA as a mean of encrypting and decrypting confidential data, they often need to worry about data separation, padding. By applying a slight change to diffie hellman, we don't need to worry about those 2 critical issues which may become a security vulnerability that people can exploit on.
Sealed box combined encryption and decryption
Initial functions
public static Byte[] Create(Byte[] Message,Byte[] OtherUserPublicKey)
public static Byte[] Open(Byte[] CipherText,Byte[] CurrentUserPublicKey, Byte[] CurrentUserSecretKey,Boolean ClearKey=false)
Example Code
Byte[] RandomMessage = SodiumRNG.GetRandomBytes(128);
RevampedKeyPair BobKeyPair = SodiumPublicKeyBox.GenerateRevampedKeyPair();
Byte[] CipherText = SodiumSealedPublicKeyBox.Create(RandomMessage, BobKeyPair.PublicKey);
Byte[] PlainText = SodiumSealedPublicKeyBox.Open(CipherText, BobKeyPair.PublicKey, BobKeyPair.PrivateKey);