	public static void main(String[] args) {
		try {			
			try {
				CORE_LOCATION = CredentialLoader.class.getClassLoader()
						.getResource("resources/irma_configuration/").toURI();
			} catch (URISyntaxException e) {
				e.printStackTrace();
				throw new RuntimeException(e.toString());
			}
			Card card = getCardFromDb(args[0]);
			Random rand = new Random();
			byte[] credentialPin = new byte[4];
			for(int i = 0; i < 4; i++) {
				credentialPin[i] = (byte) (rand.nextInt(10) + 0x30);
			}
			byte[] cardPin = new byte[6];
			for(int i = 0; i < 6; i++) {
				cardPin[i] = (byte) (rand.nextInt(10) + 0x30);
			}
			System.out.println("CORE_LOCATION: " + CORE_LOCATION);
			CredentialInformation.setCoreLocation(CORE_LOCATION);
			DescriptionStore.setCoreLocation(CORE_LOCATION);
			Attributes attributes = new Attributes();
			attributes.add("userID", card.getUserID().getBytes());
			attributes.add("securityHash", hash(card.getUserID(), Integer.toString(card.getCardId())));
			IssueCredentialInformation ici = new IssueCredentialInformation("Surfnet", "root");
			IdemixIssueSpecification spec = ici.getIdemixIssueSpecification();
			IdemixPrivateKey isk = ici.getIdemixPrivateKey();
			CardTerminal terminal = TerminalFactory.getDefault().terminals().list().get(0);
			IdemixService is = new IdemixService(new TerminalCardService(terminal));
			IdemixCredentials ic = new IdemixCredentials(is);
			ic.connect();
			is.sendPin(TestSetup.DEFAULT_CRED_PIN);
			ic.issue(spec, isk, attributes, null);
			System.exit(0);
		}
		catch(Exception e) {
			System.err.println("Exception in Credential Loader: " + e.toString());
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		try {			
			CORE_LOCATION= new File(System
					.getProperty("user.dir")).toURI()
					.resolve("irma_configuration/");
			Card card = getCardFromDb(args[0]);
			Random rand = new Random();
			byte[] credentialPin = new byte[4];
			for(int i = 0; i < 4; i++) {
				credentialPin[i] = (byte) (rand.nextInt(10) + 0x30);
			}
			byte[] cardPin = new byte[6];
			for(int i = 0; i < 6; i++) {
				cardPin[i] = (byte) (rand.nextInt(10) + 0x30);
			}
			System.out.println("CORE_LOCATION: " + CORE_LOCATION);
			CredentialInformation.setCoreLocation(CORE_LOCATION);
			DescriptionStore.setCoreLocation(CORE_LOCATION);
			Attributes attributes = new Attributes();
			attributes.add("userID", card.getUserID().getBytes());
			attributes.add("securityHash", hash(card.getUserID(), Integer.toString(card.getCardId())));
			IssueCredentialInformation ici = new IssueCredentialInformation("Surfnet", "root");
			IdemixIssueSpecification spec = ici.getIdemixIssueSpecification();
			IdemixPrivateKey isk = ici.getIdemixPrivateKey();
			CardTerminal terminal = TerminalFactory.getDefault().terminals().list().get(0);
			IdemixService is = new IdemixService(new TerminalCardService(terminal));
			IdemixCredentials ic = new IdemixCredentials(is);
			ic.connect();
			is.sendPin(TestSetup.DEFAULT_CRED_PIN);
			ic.issue(spec, isk, attributes, null);
			System.exit(0);
		}
		catch(Exception e) {
			System.err.println("Exception in Credential Loader: " + e.toString());
			e.printStackTrace();
			System.exit(1);
		}
	}
