# frozen_string_literal: true
include Ubiq
input_file = '/tmp/data'
output_file = '/tmp/data.tmp'
file_in = File.open(input_file,'rb')
file_out = File.open(output_file,'wb')
data = file_in.read
file_out.write(data))
file_in.close()
file_out.close()
const ubiq = require('ubiq-security')
// Explicitly set the credentials.
const credentials = new Credentials('<access_key_id>', '<secret_signing_key>', '<secret_crypto_access_key>')
// Encrypt a block of data.
const encrypted_data = await ubiq.encrypt(credentials, plainntext_data)
// Decrypt a block of data.
const plainttext_data = await ubiq.decrypt(credentials, encrypted_data)
require 'ubiq-security'
include Ubiq
# Explicitly set the credentials.
credentials = Credentials(access_key_id = "...", secret_signing_key = "...", secret_crypto_access_key = "...")
# Encrypt a block of data.
encrypted_data = encrypt(credentials, plaintext_data)
# Decrypt a block of data.
plaintext_data = decrypt(credentials, encrypted_data)
# Require the Security Client.
import ubiq_security as ubiq
# Explicitly set the credentials.
credentials = ubiq.credentials(access_key_id = "...", secret_signing_key = "...", secret_crypto_access_key = "...")
# Encrypt a block of data.
encrypted_data = ubiq.encrypt(credentials, plaintext_data)
# Decrypt a block of data.
plaintext_data = ubiq.decrypt(credentials, encrypted_data)
#include <ubiq/platform.h>
struct ubiq_platform_credentials * creds = NULL;
void * ptbuf = NULL, * ctbuf = NULL;
size_t ptlen = 0, ctlen = 0;
/*
* load credentials from the environment
* or the credentials file
*/
ubiq_platform_credentials_create(creds);
/* initialize ptbuf and ptlen */
...
/* Encrypt a block of data. */
ubiq_platform_encrypt(creds, ptbuf, ptlen, ctbuf, ctlen);
/* Decrypt a block of data. */
ubiq_platform_decrypt(creds, ctbuf, ctlen, ptbuf, ptlen);
free(ctbuf);
free(ptbuf);
ubiq_platform_credentials_destroy(creds);
#include <ubiq/platform.h>
/*
* load credentials from the environment
* or the credentials file
*/
ubiq::platform::credentials creds;
std::vector ptbuf, ctbuf;
/* initialize ptbuf */
...
/* Encrypt a block of data. */
ctbuf = ubiq::platform::encrypt(creds, ptbuf.data(), ptbuf.size());
/* Decrypt a block of data. */
ptbuf = ubiq::platform::decrypt(creds, ctbuf.data(), ctbuf.size());
using UbiqSecurity;
/* explicitly set the credentials */
var credentials = UbiqFactory.CreateCredentials(accessKeyId: "...", secretSigningKey: "...", secretCryptoAccessKey: "...");
/* Encrypt a block of data. */
byte[] plainBytes = ...;
byte[] encryptedBytes = await UbiqEncrypt.EncryptAsync(credentials, plainBytes);
Decrypt a block of data. */
plainBytes = await UbiqDecrypt.DecryptAsync(credentials, encryptedBytes);
import com.ubiqsecurity.UbiqCredentials;
import com.ubiqsecurity.UbiqDecrypt;
import com.ubiqsecurity.UbiqEncrypt;
import com.ubiqsecurity.UbiqFactory;
// Explicitly set the credentials.
UbiqCredentials credentials = UbiqFactory.createCredentials("<yourAccessKey>", "<yourSigningKey>", "<yourCryptoKey>", null);
// Encrypt a block of data.
byte[] plainBytes = ...;
byte[] encryptedBytes = UbiqEncrypt.encrypt(credentials, plainBytes);
// Decrypt a block of data.
plainBytes = UbiqDecrypt.decrypt(credentials, encryptedBytes);
import "gitlab.com/ubiqsecurity/ubiq-go"
var plaintext []byte = ...
// load the default credentials
credentials, _ := ubiq.NewCredentials()
// encrypt a block of data
ciphertext, _ := ubiq.Encrypt(credentials, plaintext)
// decrypt a block of data
plaintext, _ := ubiq.Decrypt(credentials, ciphertext)