Add tests for Crypt

Tests for  #1739