Viewing File: /usr/lib/python2.7/site-packages/keyczar/writers.pyo

ó
NÑPc@scdZddlZddlZddlZd„Zdefd„ƒYZdefd„ƒYZdS(su
A Writer supports writing metadata and key info for key sets.

@author: rleftwich@lightkeeper.com (Robert Leftwich)
iÿÿÿÿNcCsQtjƒx-tjƒD]}|j|ƒ}|r|SqWtjd|ƒ‚dS(s„Factory function for Writers
  
    @param location: where (file, uri, etc) the writer should write to
    @type location: string
  s:Unable to create a writer for %s. Does the location exist?N(tutiltImportBackendstWritert__subclasses__tCreateWriterterrorstKeyczarError(tlocationtsctwriter((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyRs
RcBsteZdZejZejed„ƒZejdd„ƒZ
ejd„ƒZejd„ƒZe
d„ƒZRS(sJAbstract class/interface providing supported methods for writing key sets.cCsdS(sµ
    Write the metadata for the key.
    
    @param metadata: metadata for key
    @type: KeyMetadata
    
    @raise KeyczarError: if unable to write metadata (e.g. IOError) 
    N((tselftmetadatat	overwrite((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyt
WriteMetadata.s
cCsdS(sa
    Write out the key at the given version.
    
    @param key: key value
    @type: string
    
    @param version_number: the version number of the key
    @type version_number: integer
    
    @param encrypter: existing Keyczar encrypter for key
    @type: Keyczar.Crypter

    @raise KeyczarError: if unable to write key info (e.g. IOError) 
    N((R
tkeytversion_numbert	encrypter((s3/usr/lib/python2.7/site-packages/keyczar/writers.pytWriteKey:scCsdS(sÚ
    Remove the key for the given version.
    
    @param version_number: the version number of the key
    @type version_number: integer
    
    @raise KeyczarError: if unable to remove key info (e.g. IOError) 
    N((R
R((s3/usr/lib/python2.7/site-packages/keyczar/writers.pytRemoveLs
cCsdS(sR
    Clean up this writer
    
    @raise KeyczarError: if error during close
    N((R
((s3/usr/lib/python2.7/site-packages/keyczar/writers.pytCloseXscCstd|ƒ‚dS(sE
    Return an instance of this class if it handles the location
    s6CreateWriter() class method MUST be implemented for:%sN(tNotImplementedError(tclsR((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyRasN(t__name__t
__module__t__doc__RtABCMetat
__metaclass__tabstractmethodtTrueR
tNoneRRRtclassmethodR(((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyR)s		t
FileWritercBsPeZdZd„Zed„Zdd„Zd„Zd„Z	e
d„ƒZRS(sWrite key sets to a file.cCs
||_dS(s4Construct a key set writer at the specified locationN(R(R
R((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyt__init__kscCsatjj|jdƒ}|rGtjj|ƒrGtjd|ƒ‚ntjt	|ƒ|ƒdS(s)
    Write the metadata for the key.
    tmetasFile:%s already existsN(
tostpathtjoinRtexistsRRRt	WriteFiletstr(R
RRtfname((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyR
os
cCsPt|ƒ}|r$|j|ƒ}ntj|tjj|jt|ƒƒƒdS(s1
    Write out the key at the given version.
    N(R'tEncryptRR&R"R#R$R(R
RRR((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyRys
(cCs)tjtjj|jt|ƒƒƒdS(s/
    Remove the key for the given version.
    N(R"tremoveR#R$RR'(R
R((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyRƒscCsdS(s
    Clean up this writer
    N((R
((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyR‰scCs+d}tjj|ƒr't|ƒ}n|S(sE
    Return an instance of this class if it handles the location
    N(RR"R#R%R(RRtresult((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyRsN(RRRR RR
RRRRRR(((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyRhs	

		(RR"RRRtobjectRR(((s3/usr/lib/python2.7/site-packages/keyczar/writers.pyt<module>s	?
Back to Directory File Manager