#!/bin/bash
############################################################
#                                                          #
#  AQUERRE TECHNOLOGIES LLC                                #
#  LUKS ENCRYPTION BASH SCRIPTS                            #
#  COPYRIGHT 2014-2017                                     #
#                                                          #
#  luksChangeKey -- change key of LUKS device DEV in slot  #
#                   number SLOT from CURKEY of length      #
#                   CURKEYLEN to NEWKEY of length          #
#                   NEWKEYLEN in same slot                 #
#                                                          #
############################################################

DEV=/dev/sda1
CURKEY=/home/noah/CURKEY.txt
CURKEYLEN=40
NEWKEY=/home/noah/NEWKEY.txt
NEWKEYLEN=20
SLOT=0

cryptsetup -v --key-file=${CURKEY} --keyfile-size=${CURKEYLEN} --new-keyfile-size=${NEWKEYLEN} --key-slot=${SLOT} luksChangeKey ${DEV} ${NEWKEY}
