TPickle -- TrustedPickle document
TPickle instances export the following attributes:
- Data
- Document's pickled data.
- Keys
- Dictionary of PublicKey objects. Each key object is indexed by
its 128-bit public key value.
- Signatures
- Dictionary of Signature objects. Each signature object is
indexed by the signer's 128-bit public key value.
- Trusted
- Dictionary of dictionaries. Both the inner and outer dictionaries are
indexed with 128-bit public key values. Each
Trusted[Trustee][Truster] node contains a
TrustRelationship instance where Trustee is trusting
Truster. Each TrustRelationship instance is signed with
the Truster's private key.
TPickle instances export the following functions:
- Pickle(Data)
- Pickles the given data object or module into the TPickle
instance. Do not sign a document until after you have Pickled
it.
- Read()
- Reads the document from disk.
- SetCompression([Compress])
- Sets whether the file pickle data should be compressed when written to
disk. By default, compression is on. Compress defaults to
True.
- Sign(PublicFile, Private[,
IncludeTrusts])
- Creates a valid Signature object where the
PublicFile's Owner is vouching for the document's
integrity. Call Write() after calling Sign(). If the
PrivateKey in Private does not match the Owner's
public key, then Sign() will throw a MismatchedKeys
exception. Setting IncludeTrusts to True (it defaults to
False) will include any of the Owner's "upstream" trust
relationships.
- TestSignatures([Trusted[,
Revoked]])
Checks all signatures and trust relationships in the document against
the unordered list of Trusted and Revoked users. Both
lists are made up of 128-bit public key values.
TestSignatures returns a tuple of signature class code and a
list of public keys in the class. The possible codes are TRUSTED,
TRANSFERRED, UNKNOWN, and REVOKED.
- Unpickle()
- Unpickles the document data (or imports the pickled module) and returns
it. Documents can be unpickled even if the signatures are bad. Be sure to
call TestSignatures first!
- Write()
- Writes the document to disk.
|