/// <summary> /// <inheritdoc cref="Encrypter.Decrypt{T}"/> /// </summary> /// <param name="encryptedObject"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public override T Decrypt <T>(EncryptedObject encryptedObject) { if (!(encryptedObject is EncryptedObjectPKCS7 eo)) { return(null); } var plainString = Decrypt(eo.CipherText); return(JsonConvert.DeserializeObject <T>(plainString, encryptionSerializerSettings)); }
/// <summary> /// <inheritdoc cref="Encrypter.Decrypt{T}"/> /// </summary> /// <param name="encryptedObject"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public override T Decrypt <T>(EncryptedObject encryptedObject) { var eo = (EncryptedObjectAEAD)encryptedObject; if (eo == null) { return(null); } var plainString = Decrypt(eo.CipherText, eo.AssociatedData, eo.Nonce); return(JsonConvert.DeserializeObject <T>(plainString, encryptionSerializerSettings)); }
/// <summary> /// <inheritdoc cref="Encrypter.Decrypt"/> /// </summary> /// <param name="encryptedObject"></param> /// <returns></returns> public override BusinessObject Decrypt(EncryptedObject encryptedObject) { var eo = (EncryptedObjectAEAD)encryptedObject; //(EncryptedObjectAEAD)BoMapper.MapObject("EncryptedObjectAEAD", JObject.FromObject(encryptedObject)); if (eo == null) { return(null); } var plainString = Decrypt(eo.CipherText, eo.AssociatedData, eo.Nonce); return(JsonConvert.DeserializeObject <BusinessObject>(plainString, encryptionSerializerSettings)); }
/// <summary> /// <inheritdoc cref="Encrypter.Decrypt{T}"/> /// </summary> /// <param name="encryptedObject"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public override T Decrypt <T>(EncryptedObject encryptedObject) { var eo = (EncryptedObjectPublicKeyBox) encryptedObject; // (EncryptedObjectPublicKeyBox)BoMapper.MapObject("EncryptedObjectPublicKeyBox", JObject.FromObject(encryptedObject)); if (eo == null) { return(null); } var plainString = Decrypt(eo.CipherText, eo.PublicKey, eo.Nonce); return(JsonConvert.DeserializeObject <T>(plainString, encryptionSerializerSettings)); }
/// <summary> /// Decrypt <paramref name="encryptedObject"/> /// </summary> /// <param name="encryptedObject"></param> /// <typeparam name="T">expected type</typeparam> /// <returns>decrypted object</returns> public abstract T Decrypt <T>(EncryptedObject encryptedObject) where T : BusinessObject;
/// <summary> /// decrypt an encrypted Business Object /// </summary> /// <param name="encryptedObject">an encrypted Business Object</param> /// <returns>a decrypted Business Object</returns> public abstract BusinessObject Decrypt(EncryptedObject encryptedObject);