This file contains 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
# Requires the Virtru Python SDK | |
# https://pypi.org/project/virtru-sdk/ | |
# https://developer.virtru.com/docs/python-encryption | |
import argparse | |
from virtru_sdk import Client, Policy, EncryptFileParams | |
def main(): | |
parser = argparse.ArgumentParser() |
This file contains 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
import argparse | |
from virtru_sdk import Client, Policy, EncryptFileParams | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument("-o", "--owner", help="AppId Owner (user@domain.com)", required=True) | |
parser.add_argument("-p", "--appid", help="AppId (1522710c-833f-4a69-8a26-0bbb00b1345c)", required=True) | |
parser.add_argument("-a", "--action", help="Action", choices=["encrypt", "decrypt"], required=True) | |
parser.add_argument("-s", "--source", help="Source File (Full path or reference path)", required=True) |
This file contains 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
import paho.mqtt.client as paho | |
import time | |
import os | |
from virtru_sdk import Client, LogLevel, Policy, EncryptStringParams | |
virtru_owner="<VIRTRU PROVIDED>" | |
virtru_appid="<VIRTRU PROVIDED>" | |
virtru_share=["user1@example.com","user2@demo.com"] | |
mqtt_broker="<IP/HOST of MQTT Broker>" |
This file contains 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
import paho.mqtt.client as paho | |
from virtru_sdk import LogLevel, Client | |
virtru_owner="<VIRTRU PROVIDED>" | |
virtru_appid="<VIRTRU PROVIDED>" | |
mqtt_broker="<IP/HOST of MQTT Broker>" | |
def on_subscribe(client, userdata, mid, granted_qos): | |
print("Subscribed: "+str(mid)+" "+str(granted_qos)) |
This file contains 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
import boto3 | |
import os | |
source = os.environ.get("source") | |
target = os.environ.get("target") | |
bucket = os.environ.get("bucket") | |
print(source) | |
print(target) | |
print(bucket) |
This file contains 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
import argparse | |
import multiprocessing | |
import os | |
import time | |
from virtru_tdf3_python import Client, Policy, EncryptFileParam, Protocol | |
class VirtruParams: | |
def __init__(self, source_file, target_file, owner, token_key, token_secret, add_user): |
This file contains 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
import argparse | |
import os | |
import threading | |
from concurrent.futures import ThreadPoolExecutor | |
from virtru_tdf3_python import Client, Policy, EncryptFileParam, Protocol | |
import time | |
class VirtruParams: | |
def __init__(self, source_file, target_file, owner, token_key, token_secret, add_user): |
This file contains 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
def decrypt_folder(source_dir, target_dir, owner, token_key, token_secret): | |
for file in os.listdir(source_dir): | |
if os.path.isfile(os.path.join(source_dir, file)): | |
decrypt_file(os.path.join(source_dir, file), os.path.join(target_dir, remove_extension(file)), owner, | |
token_key, | |
token_secret) | |
def decrypt_file(source_file, target_file, owner, token_key, token_secret): | |
print("Source - {} Target - {}".format(source_file,target_file)) |
This file contains 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
def encrypt_folder(source_dir, target_dir, owner, token_key, token_secret, add_user): | |
for file in os.listdir(source_dir): | |
if os.path.isfile(os.path.join(source_dir, file)): | |
encrypt_file(os.path.join(source_dir, file), os.path.join(target_dir, file) + ".tdf3", owner, token_key, | |
token_secret, add_user) | |
def encrypt_file(source_file, target_file, owner, token_key, token_secret, add_user): | |
print("Source - {} Target - {}".format(source_file,target_file)) | |
client = Client(owner=owner, |