Before you start downvoting spree, read this:
For Apple: https://mashable.com/2013/10/17/apple-nsa-imessage
http://bgr.com/2015/08/06/iphone-fbi-imessage-facetime-backd...
https://www.tripwire.com/state-of-security/latest-security-n...
For WhatsApp: https://tobi.rocks/
(encrypt data with random key with symmetric encryption algorythm (AES,...), which is then encrypted and stored with the mesage twice. Once encrypted with recipient public key (asymmetric: RSA,ECC) and once encrypted with apple public key. This way you can say that you are having end to end encryption while you can still read everything and you can also use all the nice words in marketing material, AES, end2end, RSA/ECC,...).