def cms_sign_text(text, signing_cert_file_name, signing_key_file_name):
 _ensure_subprocess()
 process = subprocess.Popen(['openssl', 'cms', '-sign', '-signer', signing_cert_file_name, '-inkey', signing_key_file_name, '-outform', 'PEM', '-nosmimecap', '-nodetach', '-nocerts', '-noattr'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 (output, err) = process.communicate(text)
 retcode = process.poll()
 if (retcode or ('Error' in err)):
  LOG.error(('Signing error: %s' % err))
  raise subprocess.CalledProcessError(retcode, 'openssl')
 return output

def cms_sign_text ( text , signing_cert_file_name , signing_key_file_name ) : _ensure_subprocess ( ) process = subprocess . Popen ( [ 'openssl' , 'cms' , '-sign' , '-signer' , signing_cert_file_name , '-inkey' , signing_key_file_name , '-outform' , 'PEM' , '-nosmimecap' , '-nodetach' , '-nocerts' , '-noattr' ] , stdin = subprocess . PIPE , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) ( output , err ) = process . communicate ( text ) retcode = process . poll ( ) if ( retcode or ( 'Error' in err ) ) : LOG . error ( ( 'Signing error: %s' % err ) ) raise subprocess . CalledProcessError ( retcode , 'openssl' ) return output
uses openssl to sign a document produces a base64 encoding of a der formatted cms document URL .