Created
September 18, 2020 08:43
-
-
Save typelogic/8ea2830356f4e903bb94fb3c74f4065d to your computer and use it in GitHub Desktop.
florence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void test_generate_florence_id() throws IDPassException, IOException { | |
byte[] photo = Files.readAllBytes(Paths.get("testdata/florence.jpg")); | |
Ident ident = Ident.newBuilder() | |
.setPhoto(ByteString.copyFrom(photo)) | |
.setGivenName("MARION FLORENCE") | |
.setSurName("DUPONT") | |
.setPin("1234") | |
.setDateOfBirth(Dat.newBuilder().setYear(1985).setMonth(1).setDay(1)) | |
.addPubExtra(KV.newBuilder().setKey("Sex").setValue("F")) | |
.addPubExtra(KV.newBuilder().setKey("Nationality").setValue("French")) | |
.addPubExtra(KV.newBuilder().setKey("Date Of Issue").setValue("02 JAN 2025")) | |
.addPubExtra(KV.newBuilder().setKey("Date Of Expiry").setValue("01 JAN 2035")) | |
.addPrivExtra(KV.newBuilder().setKey("ID#").setValue("SA437277")) | |
.build(); | |
IDPassReader reader = new IDPassReader(m_keyset, m_rootcerts); | |
reader.setDetailsVisible( | |
IDPassReader.DETAIL_GIVENNAME | | |
IDPassReader.DETAIL_SURNAME); | |
Card card = reader.newCard(ident,m_certchain); | |
File outputfile = new File("florence_idpass.png"); | |
ImageIO.write(card.asQRCode(), "png", outputfile); | |
File outputfile3 = new File("florence_idpass.svg"); | |
Files.write(outputfile3.toPath(), card.asQRCodeSVG().getBytes(StandardCharsets.UTF_8)); | |
//reader.saveConfiguration("alias0","florence.cfg", "changeit"); | |
reader.saveConfiguration("alias0","florence.cfg", "changeit"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment