How encrypt decrypt works?

I have made a shortcut (named A) that encrypts a file (name and content). I have also made a shortcut (named B) that finds the file and decrypts it. I am wondering how encryption works. For example where can I find the key? Is it the same for all iOS devices or IOS accounts? Can I use my own key?