class KeyDataUtil {

    public static boolean isLocked(KeyData keyData) {
        if (isFileSystem(keyData)) {
            final KeyDataConfig keyDataConfig =
                    JaxbUtil.unmarshal(
                            IOCallback.execute(() -> Files.newInputStream(keyData.getPrivateKeyPath())),
                            KeyDataConfig.class);
            return keyDataConfig.getType() == PrivateKeyType.LOCKED;
        }

        if (Objects.isNull(keyData.getConfig())) {
            return false;
        }

        return keyData.getConfig().getType() == PrivateKeyType.LOCKED;
    }

    private  KeyDataUtil();

}