This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require("crypto"); | |
var uncipheredText = 'password123'; | |
var secretkey ='your_secret_key'; | |
// Encrypte | |
var cipher = crypto.createCipher('aes192', secretkey); | |
cipher.update(uncipheredText); | |
var cipheredText = cipher.final('base64'); | |
console.log('Encrypted String :' + cipheredText); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
crypto.js:323 | |
var ret = this._binding.final(); | |
^ | |
TypeError: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length | |
at Decipher.Cipher.final (crypto.js:323:27) | |
at Object.<anonymous> (/home/ubuntu/workspace/app.js:75:22) | |
at Module._compile (module.js:456:26) | |
at Object.Module._extensions..js (module.js:474:10) | |
at Module.load (module.js:356:32) | |
at Function.Module._load (module.js:312:12) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require("crypto"); | |
var uncipheredText = 'password123'; | |
var secretkey ='your_secret_key'; | |
var cipher = crypto.createCipheriv('rc4', secretkey , ''); | |
var crypt = cipher.update(uncipheredText, 'utf8', 'base64'); | |
crypt += cipher.final('base64'); | |
console.log('Encrypted String :' + crypt ); | |
var decipher = crypto.createDecipheriv('rc4',secretkey , ''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Encrypted String :5gtIYSXKAyI+oSQ= | |
Decrypted String :password123 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StaticResource sr = [SELECT Id, Body FROM StaticResource WHERE Name = 'MyJsonFile' LIMIT 1]; | |
String body = sr.Body.toString(); | |
System.assertEquals(body, '{"key1":"value1","key2":"value2"}'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StaticResource sr = [SELECT Id,NamespacePrefix,SystemModstamp FROM StaticResource WHERE Name = 'MyJsonFile' LIMIT 1]; | |
String prefix = sr.NamespacePrefix; | |
if( String.isEmpty(prefix) ) { | |
prefix = ''; | |
} else { | |
//If has NamespacePrefix | |
prefix += '__'; | |
} | |
String srPath = '/resource/' + sr.SystemModstamp.getTime() + '/' + prefix + 'MyJsonFile'; | |
PageReference pg = new PageReference( srPath ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StaticResource sr = [SELECT Id,NamespacePrefix,SystemModstamp FROM StaticResource WHERE Name = 'JsonZip' LIMIT 1]; | |
String prefix = sr.NamespacePrefix; | |
if( String.isEmpty(prefix) ) { | |
prefix = ''; | |
} else { | |
//If has NamespacePrefix | |
prefix += '__'; | |
} | |
//Get the path of MyJsonFile.json file in Zip static resource | |
String srPath = '/resource/' + sr.SystemModstamp.getTime() + '/' + prefix + 'JsonZip/MyJsonFile.json'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:includeScript value="{!$Resource.MyJavascriptFile}"/> | |
<apex:stylesheet value="{!$Resource.styles}"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:includeScript value="{!URLFOR($Resource.LibraryZip, '/subdir/MyJavascriptFile.js')}"/> | |
<apex:stylesheet value="{!URLFOR($Resource.StyleSheetZip, 'styles.css')}"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!REQUIRESCRIPT('/resource/' & LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(NOW()),':',''),'-',''),' ',''),10) & '000/MyJavascriptFile')} |