title: How to load PKCS7 (.p7b) file in java
body: <p>I have a <code>pkcs7</code> file, and I want to load it and extract its contents.</p>
  
  <p>I tried these two methods:</p>
  
  <pre><code>byte[] bytes = Files.readAllBytes(Paths.get("myfile.p7b"));
  FileInputStream fi = new FileInputStream(file);
  
  //Creating PKCS7 object
  PKCS7 pkcs7Signature = new PKCS7(bytes);
  </code></pre>
  
  <p>or this</p>
  
  <pre><code>FileInputStream fis = new FileInputStream(new File("myfile.p7b"));
  PKCS7 pkcs7Signature = new PKCS7(fis);
  </code></pre>
  
  <p>but I got <code>IOException: Sequence tag error</code></p>
  
  <p>So how can I load this .p7b file ?</p>