OverviewObjectiveLearn how to encrypt and decrypt data.Requirements Version of ProdigyViewEstimated Time8 Minutes www.prodigyview.com
Follow Along With Code Example1. Download a copy of the example code at www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to examples/security/Encryption.php
Encrpytion A NightmareThe first time coming across encryption and php mcryptcan be something like this:
Encryption Made EasyThankfully encryption is not like that in ProdigyView. Startthis example by calling the PVSecurity::init and letscreate a string to encrypt.1. Initialize the security class 2. String to encode
Encrypting DataEncrypting data is easily accomplished by passing datainto the PVSecurity::encrypt method. Encrypt the string
Encrypting StringTrying to read an encrypted string will give you this result.To read that message, we have to decrypt the message inPVSecurity::decrypt
Encrypting with KeyBy default, the key used is defined in thePVSecurity::init. A custom key can be used whenencrypting a string and only that key can be used todecrypt it. Custom key for encrypting
Decrypting with Custom KeyOur last string we encrypted was with a set key.Decrypting without the correct key will give us this.Decrypting with the key used for encryption will returnthis.
Review1. Encrypt a file with PVSecurity::encrypt.2. Decrypt a file with PVSecurity::decrypt.3. Custom key have can be added in the options of encrypt and decrypt.4. PVSecurity::init contains the default configuration for encrypting and decrypting data.
API ReferenceFor a better understanding of Validation in ProdigyView, visitthe api by clicking on the link below.PVSecurity More Tutorials For more tutorials, please visit: http://www.prodigyview.com/tutorials www.prodigyview.com