Last active
September 18, 2020 11:57
-
-
Save typelogic/bebf048ab980d4c78c71737a55c3001a to your computer and use it in GitHub Desktop.
verify.java
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_verify_florence_id() throws IDPassException, IOException, NotFoundException { | |
// Initialize reader | |
IDPassReader reader = new IDPassReader("alias0","demokeys.cfg.p12","changeit"); | |
File qrcodeId = new File(String.valueOf(Paths.get("florence_idpass.png"))); | |
BufferedImage bufferedImage = ImageIO.read(qrcodeId); | |
// Read the QR code image | |
Card cardOriginal = reader.open(bufferedImage); | |
byte[] photo1 = Files.readAllBytes(Paths.get("testdata/florence_ID_Photo.jpg")); | |
byte[] photo2 = Files.readAllBytes(Paths.get("testdata/brad.jpg")); | |
byte[] photo3 = Files.readAllBytes(Paths.get("testdata/florence.jpg")); | |
cardOriginal.authenticateWithFace(photo1); // use hig res photo | |
String name = cardOriginal.getGivenName(); | |
assertEquals(name,"MARION FLORENCE"); | |
File zoom1 = new File(String.valueOf(Paths.get("florence_idpass.png"))); | |
BufferedImage bizoom1 = ImageIO.read(zoom1); | |
Card card2 = reader.open(bizoom1); | |
cardOriginal.authenticateWithFace(photo3); // use low res photo | |
assertEquals("MARION FLORENCE", card2.getGivenName()); | |
File zoom2 = new File(String.valueOf(Paths.get("florence_idpass.png"))); | |
BufferedImage bizoom2 = ImageIO.read(zoom2); | |
Card card3 = reader.open(bizoom2); | |
card2.authenticateWithPIN("1234"); | |
assertEquals("MARION FLORENCE", card2.getGivenName()); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment