@Override
    public DeterministicKeyChain toDecrypted(CharSequence password) {
        Objects.requireNonNull(password);
        checkArgument(password.length() > 0);
        KeyCrypter crypter = getKeyCrypter();
        checkState(crypter != null, () ->
                "chain not encrypted");
        AesKey derivedKey = crypter.deriveKey(password);
        return toDecrypted(derivedKey);
    }
@Test(expected = IllegalStateException.class)
    public void notEncrypted() {
        chain.toDecrypted("fail");
    }