BO4E-dotnet.Encryption/AsymmetricEncrypter.cs
/// <summary>
///     Encrypt a Business Object for a given public key
/// </summary>
/// <param name="plainObject">unencrypted Business Object</param>
/// <param name="publicKey">recipients public key</param>
/// <returns>An encrypted Business Object</returns>
Encrypt a Business Object for a given public key
Encrypt a Business Object for a given public key
public EncryptedObjectPublicKeyBox Encrypt(BusinessObject plainObject, string publicKey)
        {
            var plainText = JsonConvert.SerializeObject(plainObject, encryptionSerializerSettings);
            var nonce = PublicKeyBox.GenerateNonce();
            var cipherString = Encrypt(plainText, publicKey, nonce);
            return new EncryptedObjectPublicKeyBox(cipherString, Convert.ToBase64String(_ownPublicKey),
                Convert.ToBase64String(nonce));
        }
public EncryptedObjectPublicKeyBox Encrypt ( BusinessObject plainObject , string publicKey ) { var plainText = JsonConvert . SerializeObject ( plainObject , encryptionSerializerSettings ) ; var nonce = PublicKeyBox . GenerateNonce ( ) ; var cipherString = Encrypt ( plainText , publicKey , nonce ) ; return new EncryptedObjectPublicKeyBox ( cipherString , Convert . ToBase64String ( _ownPublicKey ) , Convert . ToBase64String ( nonce ) ) ; }
Encrypt a Business Object for a given public key
Encrypt a Business Object for a given public key
An encrypted Business Object
An encrypted Business Object
plainObject
BusinessObject
unencrypted Business Object
unencrypted Business Object
publicKey
string
recipients public key
recipients public key