1

I have some encrypted image files with AES, i would like to load these images into image view in my gui. However, i do not want them accessable without my gui, that decrypting them into different file is not solution for me because decrypted images can be taken while the gui is showing them. What should I do?

mugetsu
  • 188
  • 1
  • 11

1 Answers1

2

Use CipherInputStream to create a stream of deciphered image, then create a BufferedImage from CipherInputStream. Add BufferedImage to your image component. If your key is larger than 128 bit you have to install jce.

http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

https://docs.oracle.com/javase/7/docs/api/javax/crypto/CipherInputStream.html

How do I convert a InputStream to BufferedImage in Java/Groovy?

miskender
  • 7,460
  • 1
  • 19
  • 23
  • 2
    It should be noted that for JavaFX you either need to use `SwingFXUtils.toFXImage` or directly use [the correct `Image` constructor](https://docs.oracle.com/javase/8/javafx/api/javafx/scene/image/Image.html#Image-java.io.InputStream-) – fabian Feb 02 '18 at 12:58