0

Good day friends, I was able to capture and save a user fingerprint to MySQL database using digital persona sdk in java. The fingerprint is stored as bytes. Normally I'm able to convert ordinary picture from bytes to image and set it as icon to jLabel using this code

java.sql.Blob blob = rs.getBlob("profile");//get saved image
 InputStream in = blob.getBinaryStream();
        BufferedImage image = ImageIO.read(in);
                if (image != null) {
                    ImageIcon icon = new ImageIcon(image);
                    profilepic.setIcon(icon);
                }

but this doesn't seem to work for saved fingerprints. Any suggestions please?

Emperor
  • 81
  • 1
  • 9

1 Answers1

0

Who claims that rs.getBlob("profile") is an image? Images usually have some header bytes which you could inspect or post here. Isn't fingerprint data usually some kind of hashed data? Anything else would break your privacy very quickly. You don't want to enable anyone to reproduce your original fingerprint - never ever! It's really just the same with passwords. Don't store plain passwords in your database - just the hashed password, so you can validate it but the original password should not appear in any database. Even your attempt to convert the fingerprint data to an image sounds suspicious! ;)

Mick
  • 954
  • 7
  • 17
  • The fingerprint template was serialized to bytes before inserting into database. The database column type is blob. I think the `rs.getBlob("profile")` gets the bytes. The problem is converting the bytes back to image so I can display it on jlabel. – Emperor Dec 18 '19 at 10:56
  • do you think or do you know? – Mick Dec 18 '19 at 11:09
  • and please just post the first few bytes here. – Mick Dec 18 '19 at 11:09