KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21572/root/usr/lib64/python2.4/site-packages/M2Crypto/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21572/root/usr/lib64/python2.4/site-packages/M2Crypto/DSA.pyo
mò
Ô'rDc@sìdZdkZdkZdkZdkZdefd„ƒYZeieƒdfd„ƒYZdefd„ƒYZ	ei
d„Zd	„Zei
d
„Zei
d„Zei
d„Zei
d
„Zei
d„Zei
d„ZdS(sç
    M2Crypto wrapper for OpenSSL DSA API.

    Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved.

    Portions created by Open Source Applications Foundation (OSAF) are
    Copyright (C) 2004 OSAF. All Rights Reserved.
NtDSAErrorcBstZRS(N(t__name__t
__module__(((t2/usr/lib64/python2.4/site-packages/M2Crypto/DSA.pyR
stDSAcBsÎtZdZeiZdd„Zd„Zd„Zd„Z	d„Z
d„Zd„Zd	„Z
d
„Zdeid„Zdeid
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(s@
    This class is a context supporting DSA key and parameter
    values, signing and verifying.
    
    Simple example:
    
        from M2Crypto import EVP, DSA, util
        
        message = 'Kilroy was here!'
        md = EVP.MessageDigest('sha1')
        md.update(message)        
        digest = md.final()
        
        dsa = DSA.gen_params(1024)
        dsa.gen_key()
        r, s = dsa.sign(digest)
        good = dsa.verify(digest, r, s)
        if good:
            print '  ** success **'
        else:
            print '  ** verification failed **'
    icCs||_||_dS(sI
        Use one of the factory functions to create an instance.
        N(tdsatselft_pyfree(RRR((Rt__init__,s	cCs+t|ddƒo|i|iƒndS(NRi(tgetattrRtm2_dsa_freeR(R((Rt__del__4scCsti|iƒS(sp
        Return the key length.
    
        @rtype:   int
        @return:  the DSA key length in bits
        N(tm2t
dsa_keylenRR(R((Rt__len__8scCsM|dddddgjo'ttd|fƒ}||iƒSnt‚dS(s5
        Return specified DSA parameters and key values.
    
        @type  name: str
        @param name: name of variable to be returned.  Must be 
                     one of 'p', 'q', 'g', 'pub', 'priv'.
        @rtype:      str
        @return:     value of specified variable (a "byte string")
        tptqtgtpubtprivs
dsa_get_%sN(tnameR	RtmethodRRtAttributeError(RRR((Rt__getattr__Bs	cCsZ|dddgjotdƒ‚n1|ddgjotdƒ‚n||i|<dS(NRRRsset (p, q, g) via set_params()RRs"generate (pub, priv) via gen_key()(RRtvalueRt__dict__(RRR((Rt__setattr__Ss
cCs=ti|i|ƒti|i|ƒti|i|ƒdS(sö
        Set new parameters.
        
        @warning: This does not change the private key, so it may be
                  unsafe to use this method. It is better to use
                  gen_params function to create a new DSA object.
        N(	Rt	dsa_set_pRRRt	dsa_set_qRt	dsa_set_gR(RRRR((Rt
set_params[scCsti|iƒdS(s&
        Generate a key pair.
        N(Rtdsa_gen_keyRR(R((Rtgen_keygscCs;ti|dƒ}ti|i|iƒƒ}|i
ƒ|S(sÅ
        Save the DSA parameters to a file.
    
        @type  filename: str
        @param filename: Save the DSA parameters to this file.
        @return:         1 (true) if successful
        twbN(tBIOtopenfiletfilenametbioRtdsa_write_params_bioRRt_ptrtrettclose(RR$R%R(((Rtsave_paramsns

cCsti|i|iƒƒS(sÆ
        Save DSA parameters to a BIO object.
    
        @type  bio: M2Crypto.BIO object
        @param bio: Save DSA parameters to this object.
        @return:    1 (true) if successful
        N(RR&RRR%R'(RR%((Rtsave_params_bio{staes_128_cbccCs5titdƒ}|i|||ƒ}|i	ƒ|S(sU
        Save the DSA key pair to a file.
    
        @type  filename: str
        @param filename: Save the DSA key pair to this file.
        @type  cipher:   str
        @param cipher:   name of symmetric key algorithm and mode
                         to encrypt the private key.
        @return:         1 (true) if successful
        R!N(
R"R#tfilepathR%Rtsave_key_biotciphertcallbackR(R)(RR$R/R0R%R(((Rtsave_key…s

cCsŒ|djo ti|i|iƒ|ƒSn\t	t|dƒ}|djotd|ƒ‚n
|ƒ}ti|i|iƒ||ƒSdS(s[
        Save DSA key pair to a BIO object.
    
        @type  bio:    M2Crypto.BIO object
        @param bio:    Save DSA parameters to this object.
        @type  cipher: str
        @param cipher: name of symmetric key algorithm and mode
                       to encrypt the private key.
        @return:       1 (true) if successful
        sno such cipher: %sN(
R/tNoneRtdsa_write_key_bio_no_cipherRRR%R'R0R	tciphRtdsa_write_key_bio(RR%R/R0R4((RR.–s

	cCs/titdƒ}|i|ƒ}|iƒ|S(sÿ
        Save the DSA public key (with parameters) to a file.
    
        @type  filename: str
        @param filename: Save DSA public key (with parameters) 
                         to this file.
        @return:         1 (true) if successful
        R!N(R"R#R-R%Rtsave_pub_key_bioR(R)(RR$R%R(((Rtsave_pub_key­s

cCsti|i|iƒƒS(sý
        Save DSA public key (with parameters) to a BIO object.
    
        @type  bio: M2Crypto.BIO object
        @param bio: Save DSA public key (with parameters) 
                    to this object.
        @return:  1 (true) if successful
        N(Rtdsa_write_pub_key_bioRRR%R'(RR%((RR6»scCsti|i|ƒS(sK
        Sign the digest.
    
        @type  digest: str
        @param digest: SHA-1 hash of message (same as output 
                       from MessageDigest, a "byte string")
        @rtype:        tuple
        @return:       DSA signature, a tuple of two values, r and s,
                       both "byte strings".
        N(Rtdsa_signRRtdigest(RR:((RtsignÆs
cCsti|i|||ƒS(s
        Verify a newly calculated digest against the signature 
        values r and s.
    
        @type  digest: str
        @param digest: SHA-1 hash of message (same as output 
                       from MessageDigest, a "byte string")
        @type  r:      str
        @param r:      r value of the signature, a "byte string"
        @type  s:      str
        @param s:      s value of the signature, a "byte string"
        @rtype:        int
        @return:       1 (true) if verify succeeded, 0 if failed
        N(Rt
dsa_verifyRRR:trts(RR:R=R>((RtverifyÔscCsti|i|ƒS(N(Rt
dsa_sign_asn1RRR:(RR:((Rt	sign_asn1æscCsti|i||ƒS(N(Rtdsa_verify_asn1RRR:tblob(RR:RC((Rtverify_asn1êscCsti|iƒS(s—
        Check to be sure the DSA object has a valid private key.
    
        @rtype:   int
        @return:  1 (true) if a valid private key
        N(Rt
dsa_check_keyRR(R((Rt	check_keyîs(RRt__doc__Rtdsa_freeR
RRRRRRR R*R+tutiltpassphrase_callbackR1R.R7R6R;R?RARDRF(((RRs(			
					
	
						tDSA_pubcBs8tZdZd„ZeZd„ZeiZei	Z
RS(s•
    This class is a DSA context that only supports a public key 
    and verification.  It does NOT support a private key or 
    signing.
    
    cGstdƒ‚dS(Ns!DSA_pub object has no private key(R(Rtargv((RR;scCsti|iƒS(N(Rtdsa_check_pub_keyRR(R((RRFs(RRRGR;RARFRR7R1R6R.(((RRKús			cCs<ti||ƒ}|djotdƒ‚nt|dƒS(sô
    Factory function that generates DSA parameters and 
    instantiates a DSA object from the output.

    @type  bits: int
    @param bits: The length of the prime to be generated. If 
                 'bits' < 512, it is set to 512.
    @type  callback: function
    @param callback: A Python callback object that will be 
                 invoked during parameter generation; it usual 
                 purpose is to provide visual feedback.
    @rtype:   DSA
    @return:  instance of DSA.
    s!problem generating DSA parametersiN(Rtdsa_generate_parameterstbitsR0RR2RR(ROR0R((Rt
gen_paramss

cCsItiƒ}ti||ƒti||ƒti||ƒt	|dƒS(s8
    Factory function that instantiates a DSA object with DSA
    parameters.

    @type  p: str
    @param p: value of p, a "byte string"
    @type  q: str
    @param q: value of q, a "byte string"
    @type  g: str
    @param g: value of g, a "byte string"
    @rtype:   DSA
    @return:  instance of DSA.
    iN(
Rtdsa_newRRRRRRRR(RRRR((RR&s
cCs,ti|ƒ}t||ƒ}|iƒ|S(s
    Factory function that instantiates a DSA object with DSA 
    parameters from a file.

    @type  file:     str
    @param file:     Names the file (a path) that contains the PEM 
                     representation of the DSA parameters. 
    @type  callback: A Python callable
    @param callback: A Python callback object that will be 
                     invoked if the DSA parameters file is 
                     passphrase-protected.
    @rtype:          DSA
    @return:         instance of DSA.
    N(R"R#tfileR%tload_params_bioR0R(R)(RRR0R%R(((Rtload_params:s

cCsBti|iƒ|ƒ}|djotdƒ‚nt|dƒS(s
    Factory function that instantiates a DSA object with DSA
    parameters from a M2Crypto.BIO object.

    @type  bio:      M2Crypto.BIO object
    @param bio:      Contains the PEM representation of the DSA 
                     parameters. 
    @type  callback: A Python callable
    @param callback: A Python callback object that will be 
                     invoked if the DSA parameters file is 
                     passphrase-protected.
    @rtype:          DSA
    @return:         instance of DSA.
    sproblem loading DSA parametersiN(	Rtdsa_read_paramsR%R'R0RR2RR(R%R0R((RRSOs

cCs,ti|ƒ}t||ƒ}|iƒ|S(sø
    Factory function that instantiates a DSA object from a
    PEM encoded DSA key pair.

    @type  file:     str
    @param file:     Names the file (a path) that contains the PEM 
                     representation of the DSA key pair. 
    @type  callback: A Python callable
    @param callback: A Python callback object that will be 
                     invoked if the DSA key pair is 
                     passphrase-protected.
    @rtype:          DSA
    @return:         instance of DSA.
    N(R"R#RRR%tload_key_bioR0R(R)(RRR0R%R(((Rtload_keyds

cCs<ti|iƒ|ƒ}|ptdƒ‚nt|dƒS(së
    Factory function that instantiates a DSA object from a
    PEM encoded DSA key pair.

    @type  bio:      M2Crypto.BIO object
    @param bio:      Contains the PEM representation of the DSA 
                     key pair. 
    @type  callback: A Python callable
    @param callback: A Python callback object that will be 
                     invoked if the DSA key pair is 
                     passphrase-protected.
    @rtype:          DSA
    @return:         instance of DSA.
    sproblem loading DSA key pairiN(Rtdsa_read_keyR%R'R0RRR(R%R0R((RRVys
cCs,ti|ƒ}t||ƒ}|iƒ|S(sg
    Factory function that instantiates a DSA_pub object using
    a DSA public key contained in PEM file.  The PEM file 
    must contain the parameters in addition to the public key.

    @type  file:     str
    @param file:     Names the file (a path) that contains the PEM 
                     representation of the DSA public key. 
    @type  callback: A Python callable
    @param callback: A Python callback object that will be 
                     invoked should the DSA public key be 
                     passphrase-protected.
    @rtype:          DSA_pub
    @return:         instance of DSA_pub.
    N(R"R#RRR%tload_pub_key_bioR0R(R)(RRR0R%R(((Rtload_pub_keyŽs

cCs<ti|iƒ|ƒ}|ptdƒ‚nt|dƒS(se
    Factory function that instantiates a DSA_pub object using
    a DSA public key contained in PEM format.  The PEM 
    must contain the parameters in addition to the public key.

    @type  bio:      M2Crypto.BIO object
    @param bio:      Contains the PEM representation of the DSA 
                     public key (with params). 
    @type  callback: A Python callable
    @param callback: A Python callback object that will be 
                     invoked should the DSA public key be 
                     passphrase-protected.
    @rtype:          DSA_pub
    @return:         instance of DSA_pub.
    sproblem loading DSA public keyiN(Rtdsa_read_pub_keyR%R'R0tdsapubRRK(R%R0R\((RRY¤s
(RGtsysRIR"Rt	ExceptionRtdsa_initRRKtgenparam_callbackRPRRJRTRSRWRVRZRY(RIRPR"RWRKRYRR]RZRRTRRVRSR((Rt?s	
é	

Anon7 - 2021