RadaeePDF.com :: Topic: Does Radaee provide encription (1/4)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: Does Radaee provide encription

Does Radaee provide encription 2 years 9 months ago #7353

  • asliyanage
  • asliyanage's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 105
  • Karma: 0
I need to know does radaee library provide encryption facility for pdf ?
The administrator has disabled public write access.

Does Radaee provide encription 2 years 9 months ago #7357

  • Davide
  • Davide's Avatar
  • OFFLINE
  • Moderator
  • Posts: 663
  • Thank you received: 43
  • Karma: 12
Yes,

there are simple codes in PDFTestAct.

//byte key[] = new byte[16];
//stream.open("/sdcard/ttt.pdf", key);//pdf file to encrypt.
//stream.ImportFromFile("/sdcard/test.pdf");//import test.pdf and encrypt to ttt.pdf
//stream.ExportToFile("/sdcard/test1.pdf");//decrypt to test1.pdf
//stream.close();
The administrator has disabled public write access.

Does Radaee provide encription 2 years 7 months ago #7906

  • asliyanage
  • asliyanage's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 105
  • Karma: 0
can you please tell me what is stream and what is the need for byte array?

I have a pdf file in sdcard/pdf/abc.pdf .I need to encrypt the abc.pdf file.could you please tell me the way to do this ?
The administrator has disabled public write access.

Does Radaee provide encription 2 years 7 months ago #7916

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
2 level encryptin supported.
1. PDF standard encryption, see Doument.EncryptAs()
2. APP level encryption, which Davide memtioned.
//byte key[] = new byte[16];
//stream.open("/sdcard/ttt.pdf", key);//pdf file to encrypt.
//stream.ImportFromFile("/sdcard/test.pdf");//import test.pdf and encrypt to ttt.pdf
//stream.ExportToFile("/sdcard/test1.pdf");//decrypt to test1.pdf
//stream.close();
the key must be 16 bytes long, can be any values to set, which both used to encryption and dcryption.
in sample, key not set any value, so java init as all 0.
Last Edit: 2 years 7 months ago by .
The administrator has disabled public write access.

Does Radaee provide encription 2 years 7 months ago #8008

  • asliyanage
  • asliyanage's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 105
  • Karma: 0
I used below code to open the pdf file.Please tell me the way to encrypt this pdf file.path has the pdf file path.


m_doc.Close();
int ret = m_doc.Open(path, null);
if (ret == 0) {

m_reader.setVisibility(View.VISIBLE);
m_reader.PDFOpen(m_doc, false, this);
m_reader.PDFOpen(m_doc, false, this);


mContentView.removeAllViews();
mContentView.addView(m_layout);

}
The administrator has disabled public write access.

Does Radaee provide encription 2 years 7 months ago #8011

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
first you can use this to encrypt PDF file:
byte file_id[] = new byte[16];
//set any bytes to file_id.
int ret = m_doc.Open("sdcard/pdf1.pdf", null);
m_doc.EncryptAs( "sdcard/pdf2.pdf", "owner password", "user password", -1, 0, file_id );
m_doc.Close();
now it saved to pdf2.pdf, and then open pdf2.pdf
int ret = m_doc.Open("sdcard/pdf2.pdf", "user password");//do not forgot password, that passed to EncryptAs
//to do ...
m_doc.Close();
NOTICE:this need premium license.
Last Edit: 2 years 7 months ago by .
The administrator has disabled public write access.
Powered by Kunena Forum