We have a problem using PDFAESStream to decode a pdf.
We do have certain requirements, so after it didn't work the first time, we changed things a bit. But we still get a int ret =-3 trying to open the stream.
To open the pdf, we use:
PDFAESStream stream = new PDFAESStream();
stream.open(m_filePathString, GetData.getInstance().getKeyBytes(), GetData.getInstance().getIVBytes());
m_doc = new Document();
int ret = m_doc.OpenStream(stream, null); //no password on the pdf itself
mPDFReader.PDFOpen(m_doc,false,this);
We use php to encode our files ("openssl enc -e -aes-256-cbc") using a 32byte key and a random 16byte IV.
The file decodes correctly using our custom iOS solution;. the pdf file is valid and readable/displayable.
I have changed the signiture of PDFAESStream.open( String path, byte[] key) to PDFAESStream.open( String path, byte[] key , byte[] ivb) because we do use a random iv for every file (this is needed for encryption safety: PDFAESStream SHOULD use this too instead of using a fixed IV!).
As our keybytes are a byte[32], I have also changed:
static private int BLOCK_DEC_SIZE = BLOCK_ENC_SIZE-32; //this was -16
But the pdf file still will not open. Could this have anything to do with the static private int BLOCK_ENC_SIZE = 4096;? Or maybe the many "-4"'s found the rest of the code?
Please help us decode our pdf without having to pre-decode it ourselves to disc! Thanks!