title: Ruby to Java Crypto Functionality using BouncyCastle
body: <p>I am trying to convert some ruby openssl calls to java (using BouncyCastle). however its my first time using BouncyCastle, so I am having some issues with figuring out some of the API usage for my case.</p>
  
  <p>Essentially, I am trying to convert Apples MDM Enrollment process to Java. Apples sample code is written in Ruby, and it starts off as follows:</p>
  
  <pre><code>p7sign = OpenSSL::PKCS7.new(input)
  store = OpenSSL::X509::Store.new
  p7sign.verify(nil, store, nil, OpenSSL::PKCS7::NOVERIFY)
  p7enc = OpenSSL::PKCS7::PKCS7.new(p7sign.data)
  out = p7enc.decrypt(key, cert)
  </code></pre>
  
  <p>Unfortunately, I haven't really found the BouncyCastle documentation to be very helpful, so any help in how to convert this to java would be appreciated.</p>
  
  <p>Thanks in advance for any help you can provide,</p>