Skip to content

Instantly share code, notes, and snippets.

@after-ephemera
Created March 4, 2019 03:53
Show Gist options
  • Save after-ephemera/59c9d6aa483b4c22093a08bbab20dba0 to your computer and use it in GitHub Desktop.
Save after-ephemera/59c9d6aa483b4c22093a08bbab20dba0 to your computer and use it in GitHub Desktop.
// Encrypt message with the key, using public key
var encryptedData = cipherWrapper.encrypt(data, masterKey?.public)
// Output is:
// aB9Ce9d5oM0/yloLQikOz8RovWHLmoQf3ovlCiz+D9+0/y7ZDfx6SpPYsKFIK3df079DNVIGVXIW
// 63CIUrrc7zLPMCCHCnzoeNJMqj2z0mFclluXzr5mCDJYfU/63yPeUpCPuo3y1SfXPPPNYJKhz2pq
// TugVE+rWoql9019BwTKtBy80nOE4RDQnMe6M9FWcSv/k6NyFtml9iwwtGVuRGXpSgh9humMWT0Cu
// MxzHusdIaRaviY4mQLFS+iIyRC3Riu0OxbkgTWpDs937Vfv3LSslJSo2CvwqFEnMGhkGvMdjtNhJ
// vGnpzMYN/rYWt/cer8nreURscXN7o3IR8ZtPkA==
// Decrypt message with the key, using private key
var decryptedData = cipherWrapper.decrypt(encryptedData, masterKey?.private)
// Encrypt message with the key, using public key
var encryptedData = cipherWrapper.encrypt(data, masterKey?.public)
// Output is:
// aB9Ce9d5oM0/yloLQikOz8RovWHLmoQf3ovlCiz+D9+0/y7ZDfx6SpPYsKFIK3df079DNVIGVXIW
// 63CIUrrc7zLPMCCHCnzoeNJMqj2z0mFclluXzr5mCDJYfU/63yPeUpCPuo3y1SfXPPPNYJKhz2pq
// TugVE+rWoql9019BwTKtBy80nOE4RDQnMe6M9FWcSv/k6NyFtml9iwwtGVuRGXpSgh9humMWT0Cu
// MxzHusdIaRaviY4mQLFS+iIyRC3Riu0OxbkgTWpDs937Vfv3LSslJSo2CvwqFEnMGhkGvMdjtNhJ
// vGnpzMYN/rYWt/cer8nreURscXN7o3IR8ZtPkA==
// Decrypt message with the key, using private key
var decryptedData = cipherWrapper.decrypt(data, masterKey?.private)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment