Security
Providing encryption, decryption, encoding, and decoding methods
Two way encryption
var text = "original text";
var encrpted = k.security.encrypt(text, "mysecretykeyone");
var decrypted = k.security.decrypt(encrpted, "mysecretykeyone");
k.response.write(decrypted);
RSA
Generate Keys
let keys = k.security.rsa.generateKeys(1024);
let privatekey = keys.privateKey;
let publickey = keys.publicKey;
Encrpty and Decrypt
k.security.rsa.encrypt(publickey: string, content: string): string
k.security.rsa.decrypt(privatekey: string, content: string): string
MD5
var input = "myvalue";
var md5value = k.security.md5(input);
SHA
let input = "myvalue";
let shaHexValue = k.security.sha256(input);
let shaHexValue2 = k.security.sha1(input);
let shaHexValue3 = k.security.sha512(input);
let shaHexValue4 = k.security.sha256Binary(input);
Base64
Methods
k.security.fromBase64(base64string: string): string
k.security.toBase64(input: string): string
Guid
k.security.newGuid();
k.security.shortGuid();