IoT CAS Frameworks/IOT_Server/Server_Admin_Framework/source/ConsumerAPI/src/java/license/EncryptDecrypt.java
public String encrypt(String unencryptedString) {
        String encryptedString = null;
        try {
            cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivspec);
            byte[] plainText = unencryptedString.getBytes(UNICODE_FORMAT);
            System.out.println("plainText="+plainText);
            byte[] encryptedText = cipher.doFinal(plainText);
            System.out.println("encryptedText="+encryptedText);
            encryptedString = Base64.encodeBase64String(encryptedText);
            System.out.println("encryptedString" + encryptedString);

        } catch (Exception e) {
            System.out.println("EncryptDecrypt::encrypt()..." + e.getMessage());
            e.printStackTrace();
        }
        return encryptedString;
    }
/**
     * Method To Encrypt the license key string
     */
Method To Encrypt the license key string
Method To Encrypt the license key string
public String encrypt(String unencryptedString) {
        String encryptedString = null;
        try {
            cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivspec);
            byte[] plainText = unencryptedString.getBytes(UNICODE_FORMAT);
            System.out.println("plainText="+plainText);
            byte[] encryptedText = cipher.doFinal(plainText);
            System.out.println("encryptedText="+encryptedText);
            encryptedString = Base64.encodeBase64String(encryptedText);
            System.out.println("encryptedString" + encryptedString);
        } catch (Exception e) {
            System.out.println("EncryptDecrypt::encrypt()..." + e.getMessage());
            e.printStackTrace();
        }
        return encryptedString;
    }
public String encrypt ( String unencryptedString ) { String encryptedString = null ; try { cipher . init ( Cipher . ENCRYPT_MODE , secretKey , ivspec ) ; byte [ ] plainText = unencryptedString . getBytes ( UNICODE_FORMAT ) ; System . out . println ( "plainText=" + plainText ) ; byte [ ] encryptedText = cipher . doFinal ( plainText ) ; System . out . println ( "encryptedText=" + encryptedText ) ; encryptedString = Base64 . encodeBase64String ( encryptedText ) ; System . out . println ( "encryptedString" + encryptedString ) ; } catch ( Exception e ) { System . out . println ( "EncryptDecrypt::encrypt()..." + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } return encryptedString ; }
Method To Encrypt the license key string
Method To Encrypt the license key string