docs: def create_signature_block(openssl_digest, certificate, private_key,
                             extra_certs, data):
  
      """
      Produces a signature block for the data.
  
      Reference
      ---------
      http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#Digital_Signatures
  
      Note: Oracle does not specify the content of the "signature
      file block", friendly saying that "These are binary files
      not intended to be interpreted by humans".
  
      :param openssl_digest: alrogithm known to OpenSSL used to digest the data
      :type openssl_digest: str
      :param certificate: filename of the certificate file (PEM format)
      :type certificate: str
      :param private_key:filename of private key used to sign (PEM format)
      :type private_key: str
      :param extra_certs: additional certificates to embed into the signature (PEM format)
      :type extra_certs: array of filenames
      :param data: the content to be signed
      :type data: bytes
      :returns: content of the signature block file as produced by jarsigner
      :rtype: bytes
      """  # noqa
  
      smime = SMIME.SMIME()
      with BIO.openfile(private_key) as k, BIO.openfile(certificate) as c:
          smime.load_key_bio(k, c)
  
      if extra_certs is not None:
          # Could we use just X509.new_stack_from_der() instead?
          stack = X509.X509_Stack()
          for cert in extra_certs:
              stack.push(X509.load_cert(cert))
          smime.set_x509_stack(stack)
  
      pkcs7 = smime.sign(BIO.MemoryBuffer(data),
                         algo=openssl_digest,
                         flags=(SMIME.PKCS7_BINARY |
                                SMIME.PKCS7_DETACHED |
                                SMIME.PKCS7_NOATTR))
      tmp = BIO.MemoryBuffer()
      pkcs7.write_der(tmp)
      return tmp.read()