Strategic Software Consultant

I'm the partner of choice for many of the world's leading enterprises. I help businesses elevate their value through solution discovery, software development, design, QA, and consultancy services. As your Strategic Software Consultant, I work across many technology products and delivery teams. The scope of technology is broad, and it is my job to understand how your technology applications holistically support and connect to create a sustainable technology ecosystem. The ecosystem of technologies may span to 3rd party applications, in-house developed solutions, business intelligence, data integrations, and of course, SaaS applications.

Oracle Certified Specialist
Customer Portal Oracle B2C Service

B2C Service Encryption Example

<?php

namespace Custom\Libraries;

use RightNow\Connect\v1_4 as RNCPHP,
   RightNow\Connect\Crypto\v1_4 as Crypto;

class Encryption
{
    /**
     * This library can be loaded a few different ways depending on where it's being called:
     *
     * From a widget or model: $this->CI->load->library('Encryption');
     *
     * From a custom controller: $this->load->library('Encryption');
     *
     * Everywhere else, including other libraries: $CI = get_instance();
     *                                             $CI->load->library('Encryption')->encrypt();
     */
    function __construct(){
        $context = RNCPHP\ConnectAPI::getCurrentContext();
        $context->ApplicationContext = "EncryptCpHelper";
    }

    function encrypt($str){
        $cipher = new Crypto\AES();
        $cipher->Mode->ID =1;
        $cipher->IV->Value = "1234567812345678";
        $cipher->KeySize->LookupName = "128_bits";
        $cipher->Text = $str;
        $cipher->KeyDerivative = new Crypto\CryptoKeyDerivative();
        $cipher->KeyDerivative->Mode->ID = 2;
        $cipher->KeyDerivative->Salt = new Crypto\CryptoKeyDerivativeSalt();
        $cipher->KeyDerivative->Salt->Value = "HGTRFSRUIKHGBVFD";
        $cipher->KeyDerivative->Password = "z3&|]5)b qK~N(w";
        $cipher->KeyDerivative->Iteration = 1000;
        $cipher->encrypt();
        $encrypted_text = $cipher->EncryptedText;
        return base64_encode($encrypted_text);
    }

    function decrypt($str){
        $cipher = new Crypto\AES();
        $cipher->Mode->ID =1;
        $cipher->IV->Value = "1234567812345678";
        $cipher->KeySize->LookupName = "128_bits";
        $cipher->EncryptedText = $str;
        $cipher->KeyDerivative = new Crypto\CryptoKeyDerivative();
        $cipher->KeyDerivative->Mode->ID = 2;
        $cipher->KeyDerivative->Salt = new Crypto\CryptoKeyDerivativeSalt();
        $cipher->KeyDerivative->Salt->Value = "HGTRFSRUIKHGBVFD";
        $cipher->KeyDerivative->Password = "z3&|]5)b qK~N(w";
        $cipher->KeyDerivative->Iteration = 1000;
        $cipher->decrypt();
        $decrypted_text = $cipher->Text;
        return $decrypted_text;
    }
}

Leave a comment

Your email address will not be published. Required fields are marked *