Beispiel #1
0
def encrypt(ctx, key, password):
    note = get_note(ctx.data, key)

    aes_key = crypt.password_digest(password)
    ciphertext = crypt.encrypt(note.content, aes_key)
    encrypted_note = Note.create(note.title, encrypted=True)

    # TODO: Refacator this out, see container.Note
    with encrypted_note.path.open('bw') as f:
        f.write(ciphertext)
Beispiel #2
0
def decrypt(ctx, key, password):
    note = get_note(ctx.data, key)

    aes_key = crypt.password_digest(password)
    ciphertext = crypt.encrypt(note.content, aes_key)
    print(ciphertext)