Applying cryptography to secure data at rest and in motion