I am attempting to encrypt the file that is generated by Itext:
def download
  str  = Rjb::import("java.lang.String");
  pw = Rjb::import("com.lowagie.text.pdf.PdfWriter")
  d = Rjb::import("com.lowagie.text.Document")
  ba = Rjb::import("java.io.ByteArrayOutputStream")
  b = ba.new()
  p = Rjb::import("com.lowagie.text.Paragraph")
  document = d.new()
  s = str.new("user")
  pwd = s.getBytes()
  writer = pw.getInstance(document, b)
  writer.setEncryption(pwd, pwd,2052,1);
  document.open()
  document.add(p.new("Hello!!!"))
  document.close()
  bytes = b.toByteArray()
  send_data(bytes, {:filename => "Letters For Printing.pdf", :type
=>
"application/pdf"})
  end
Every time I call the above method I get the error :
 NoClassDefFoundError in LettersController#download
org/bouncycastle/asn1/ASN1OctetString
RAILS_ROOT: C:/ruby/letter4sure
Application Trace | Framework Trace | Full Trace
app/controllers/letters_controller.rb:184:in `method_missing''
app/controllers/letters_controller.rb:184:in `download''
-e:2:in `load''
-e:2
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in
`send''
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require''
script/server:3
-e:2:in `load''
-e:2
Request
Parameters:
{"id"=>"77"}
Show session dump
---
:expires_at: 2008-07-14 15:01:23.454000 -04:00
:csrf_id: ac3da650bca5dc0064b04b6f2b9c6632
:refer_to:
:user_id: 1
:return_to: /letters/download/75
flash: !map:ActionController::Flash::FlashHash {}
Response
Headers:
{"cookie"=>[],
 "Cache-Control"=>"no-cache"}
--
It works if I comment out the setEncryption method. When I attempt to
encrypt in the java file and then send the pdf I get the same error. :
 NoClassDefFoundError in LettersController#download
org/bouncycastle/asn1/ASN1OctetString
RAILS_ROOT: C:/ruby/letter4sure
Application Trace | Framework Trace | Full Trace
app/controllers/letters_controller.rb:172:in `method_missing''
app/controllers/letters_controller.rb:172:in `download''
--
What is going on here? I went to itext so I could send encrypted
files....
-- 
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---