Ñò Ã#xPc @sddklZddklZddklZddkZddklZddkZddk Z dZ e d„Z de fd „ƒYZ dS( iÿÿÿÿ(tipautil(tnsslib(tpkcs10N(tsha1s %s IPA CAcCs||S(N((trealmtformat((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pytget_ca_nicknamestCertDBcBsqeZdZd ed„Zd„Zd d„Zd„Zd„Z ddd„Z d ed „Z d d d „Z RS( s­ To be used for temporary NSS databases only. If temporary is set then this willcompletely remove the database it is working on when the class is destroyed. cCsã|djotiddƒ}n|djo|iƒ}n||_||_||_|d|_|d|_|d|_ t |idƒ}|i |iƒ|i ƒt i|dƒp|idd |igƒndS( Ntprefixscertdb-s/noises/pwds/csr.txttws /secmod.dbs-Ns-f(tNonettempfiletmkdtemptgenerate_randomtsecdirtpasswordt temporaryt noise_filetpwd_filetcsr_filetopentwritetcloseRt file_existst run_certutil(tselfRRRtf((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pyt__init__&s         cCsI|ioti|iƒn(ti|iƒoti|iƒndS(N( RtshutiltrmtreeRRRRtostremove(R((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pyt__del__9s cCs,dd|ig}||}ti||ƒS(Ns/usr/bin/certutils-d(RRtrun(Rtargststdintnew_args((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pyRAs cCsttiƒƒiƒS(N(RRtipa_generate_passwordt hexdigest(R((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pyR FscCsZti|iƒoti|iƒnt|idƒ}|i|iƒƒ|iƒdS(sF Generate a noise file to be used when creating a key R N( RRRRRRRR R(RR((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pytcreate_noise_fileIs  itrsacCs |iƒdd|d|id|dt|ƒd|id|idg}|i|ƒt|id ƒ}|iƒ}|iƒd i |ƒ}t i |ƒ}|S( sŠ Generate a Certificate Signing Request (CSR) and return as a string the base-64 result with the BEGIN/END block. s-Rs-ss-os-ks-gs-zs-fs-atrt( R'RtstrRRRRt readlinesRtjoinRt strip_header(RtsubjecttkeysizetkeytypeR"Rtcsr((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pyt generate_csrVs          s Server-Certc CsO|o d}nd}dd|d|d|d|idg }|i|ƒd S( s} Add a certificate to our NSS database. Only supports base64-encoded certificates, not DER-encoded. sCT,C,Csu,u,us-As-ns-ts-is-fs-aN(RR(Rt cert_filetnicknametis_cat trust_flagR"((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pytadd_certificateos   c Cs‹|djo |i}n|id}t|dƒ}|i|ƒ|iƒdd|id|d|d|id|g }ti|ƒ|S( Ns /pkcs12_pwdR s/usr/bin/pk12utils-ds-os-ns-ks-w( R RRRRRRRR!(Rt pkcs12_fileR5Rt p12pwd_fileRR"((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pyt create_pkcs12„s         N( t__name__t __module__t__doc__R tFalseRR RR R'R3R8R;(((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pyR s    (t ipapythonRRtipalibRR tipapython.compatRRRtCA_NICKNAME_FMTRtobjectR(((s4/usr/lib/python2.6/site-packages/ipapython/certdb.pyts