403Webshell
Server IP : 35.236.43.222  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux order-form-vm-001 5.10.0-37-cloud-amd64 #1 SMP Debian 5.10.247-1 (2025-12-11) x86_64
User : deploy ( 1002)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/pysimplesoap/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/pysimplesoap/__pycache__/xmlsec.cpython-39.pyc
a

�/$ZB �@sxdZddlmZddlZddlZddlZddlmZddlm	Z	m
Z
mZmZm
Z
zddlZWneyrdZYn0dZdZdZd	Zd
ZdZd*d
d�Zdd�Zdddeefdd�Zd+dd�Zdd�Zd,dd�Zd-dd�Zd.dd�Zedk�rtdZ ee �Z!e"e!�ee d d!d"�Z#e"ee#�d#Z ee d$d$d!d"edd%�Z#e"e ee#�ee$d&��%��Z&ee#d'e#d(e&dd)��stJ�dS)/z,Pythonic XML Security Library implementation�)�print_functionN)�StringIO)�BIO�EVP�RSA�X509�m2a�
<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
  <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
  <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
  <Reference URI="%(ref_uri)s">
    <Transforms>
      <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
    </Transforms>
    <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
    <DigestValue>%(digest_value)s</DigestValue>
  </Reference>
</SignedInfo>
z�
<?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
%(signed_info)s
<SignatureValue>%(signature_value)s</SignatureValue>
%(key_info)s
%(ref_xml)s
</Signature>
aO
<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
  <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
  <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
  <Reference URI="">
    <Transforms>
       <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
       <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
    </Transforms>
    <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
    <DigestValue>%(digest_value)s</DigestValue>
  </Reference>
</SignedInfo>
z�<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
%(signed_info)s
<SignatureValue>%(signature_value)s</SignatureValue>
%(key_info)s
</Signature>z�
<KeyInfo>
  <KeyValue>
    <RSAKeyValue>
      <Modulus>%(modulus)s</Modulus>
      <Exponent>%(exponent)s</Exponent>
    </RSAKeyValue>
  </KeyValue>
</KeyInfo>
z�
<KeyInfo>
    <X509Data>
        <X509IssuerSerial>
            <X509IssuerName>%(issuer_name)s</X509IssuerName>
            <X509SerialNumber>%(serial_number)s</X509SerialNumber>
        </X509IssuerSerial>
    </X509Data>
</KeyInfo>
TcCsTt�}tdur.tj�t|��}|j||d�nddlm}||�j||d�|��S)z@Return the canonical (c14n) form of the xml document for hashingN)Z	exclusive�)�SimpleXMLElement)r�lxmlZetree�parseZ
write_c14nZ	simplexmlr
�getvalue)�xml�c14n_exc�outputZetr
�r�5/usr/lib/python3/dist-packages/pysimplesoap/xmlsec.py�canonicalizebsrcCst�t�|����S)z/Create a SHA1 hash and return the base64 string)�base64�	b64encode�hashlib�sha1�digest)Zpayloadrrr�sha1_hash_digestqsrcslt||�}||t|�d�}	t|	|�}	t�|�fdd��}
|
�t�|	����}|||	t�	|�t
|
||�d�S)zISign an XML document usign RSA (templates: enveloped -ref- or enveloping))�ref_uriZdigest_valuecs�S)Nr)�args�kwargs��passwordrr�<lambda>��zrsa_sign.<locals>.<lambda>)�ref_xmlr�signed_info�signature_value�key_info)rrrZload_keyZsignrrrrrr$)rrZprivate_keyr�certr�
sign_template�key_info_templater!r"�pkey�	signaturerrr�rsa_signvs
�

�r*cCsx|�d�r t�|�}t�|�}n
t�t�}t��}|�	|�|j
dd�|��|�t
||��|�t�|��}|dkS)zDVerify a XML document signature usign RSA-SHA1, return True if validz-----BEGIN PUBLIC KEY-----r)Zmdr	)�
startswithr�MemoryBufferrZload_pub_key_bioZload_pub_keyZcertificaterZPKeyZ
assign_rsaZ
reset_contextZverify_initZ
verify_updaterZverify_finalrZ	b64decode)rr)�keyr�bioZrsaZpubkeyZretrrr�
rsa_verify�s



r/cCspt�|jdd��}t�t�|j���d��d�}|r>t	|�nd}||||rX|�
���nd|rf|��ndd�S)zHConvert private key (PEM) to XML Signature format (RSAKeyValue/X509Data)�N�hexr�)�modulus�exponentZissuer_nameZ
serial_number)
rr�erZ	bn_to_hexZ	mpi_to_bn�n�decode�encode�x509_parse_certZ
get_issuerZas_textZget_serial_number)r(r%r'r4r3�x509rrrr$�s�r$FcCsR|rt�|�}t�|tj�}n0|�d�rBt�|�}t�|tj�}nt�|d�}|S)zECreate a X509 certificate from binary DER, plain text PEM or filenamez-----BEGIN CERTIFICATE-----r	)rr,rZ
load_cert_bioZ
FORMAT_DERr+Z
FORMAT_PEMZ	load_cert)r%�binaryr.r:rrrr9�s


r9cCst||�}|������S)z:Return the public key (PEM format) from a X509 certificate)r9�
get_pubkeyZget_rsaZas_pem)r%r;r:rrr�x509_extract_rsa_public_key�s
r=cCs t|�}t||�}|�|���S)zGValidate the certificate's authenticity using a certification authority)r9Zverifyr<)Zcacertr%r;ZcaZcrtrrr�x509_verify�s
r>�__main__zL<Object xmlns="http://www.w3.org/2000/09/xmldsig#" Id="object">data</Object>z#objectzno_encriptada.keyrz=<?xml version="1.0" encoding="UTF-8"?><Object>data%s</Object>r2)r&rzzunimercado.crtr"r#)r)T)T)F)F)F)'�__doc__Z
__future__rrr�osZ	cStringIOrZM2CryptorrrrrZ
lxml.etreer�ImportErrorZ
SIGN_REF_TMPLZSIGNED_TMPLZ
SIGN_ENV_TMPLZSIGNATURE_TMPLZKEY_INFO_RSA_TMPLZKEY_INFO_X509_TMPLrrr*r/r$r9r=r>�__name__Z
sample_xmlr�print�vars�open�readZ
public_keyrrrr�<module>
sR


�





��

Youez - 2016 - github.com/yon3zu
LinuXploit