encryption php

Post on 09-Jun-2015

1.387 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Learn how encrypt and decrypt data in ProdigyView.

TRANSCRIPT

Encryption

Overview

Objective

Learn how to encrypt and decrypt data.

Requirements

Version of ProdigyView

Estimated Time

8 Minutes

www.prodigyview.com

Follow Along With Code Example

1. 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 mcrypt can be something like this:

Encryption Made EasyThankfully encryption is not like that in ProdigyView. Start this example by calling the PVSecurity::init and lets create a string to encrypt.

1. Initialize the security class

2. String to encode

Encrypting DataEncrypting data is easily accomplished by passing data into 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 in PVSecurity::decrypt

Encrypting with Key

By default, the key used is defined in the PVSecurity::init. A custom key can be used when encrypting a string and only that key can be used to decrypt it.

Custom key for encrypting

Decrypting with Custom Key

Decrypting with the key used for encryption will return this.

Our last string we encrypted was with a set key. Decrypting without the correct key will give us this.

Review

1. 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, visit the api by clicking on the link below.

PVSecurity

www.prodigyview.com

More Tutorials

For more tutorials, please visit:

http://www.prodigyview.com/tutorials

top related