Added warnings to encode() and sign()
authorJosh Karlin <jkarlin@bbn.com>
Tue, 13 Apr 2010 20:43:02 +0000 (20:43 +0000)
committerJosh Karlin <jkarlin@bbn.com>
Tue, 13 Apr 2010 20:43:02 +0000 (20:43 +0000)
sfa/trust/credential.py
tests/testCred.py

index 4c396a9..0b76372 100644 (file)
@@ -92,6 +92,7 @@ def append_sub(doc, parent, element, text):
 ##
 # Signature contains information about an xmlsec1 signature
 # for a signed-credential
+#
 
 class Signature(object):
     refid = None
@@ -146,6 +147,11 @@ class Signature(object):
 # Credentials are encoded in one of two ways.  The legacy style places
 # it in the subjectAltName of an X509 certificate.  The new credentials
 # are placed in signed XML.
+#
+# WARNING:
+# In general, a signed credential obtained externally should
+# not be changed else the signature is no longer valid.  So, once
+# you have loaded an existing signed credential, do not call encode() or sign() on it.
 
 
 class Credential(object):
@@ -326,6 +332,10 @@ class Credential(object):
     ##
     # Encode the attributes of the credential into an XML string    
     # This should be done immediately before signing the credential.    
+    # WARNING:
+    # In general, a signed credential obtained externally should
+    # not be changed else the signature is no longer valid.  So, once
+    # you have loaded an existing signed credential, do not call encode() or sign() on it.
 
     def encode(self):
         p_sigs = None
@@ -454,6 +464,14 @@ class Credential(object):
             self.encode()
         return self.xml
 
+    ##
+    # Sign the XML file created by encode()
+    #
+    # WARNING:
+    # In general, a signed credential obtained externally should
+    # not be changed else the signature is no longer valid.  So, once
+    # you have loaded an existing signed credential, do not call encode() or sign() on it.
+
     def sign(self):
         if not self.issuer_privkey or not self.issuer_gid:
             return
index 2a694b5..4a6efde 100755 (executable)
@@ -167,7 +167,7 @@ class TestCred(unittest.TestCase):
       except CredentialNotVerifiable:
          pass      
       
-      
+      # Test that * gets translated properly
 
 if __name__ == "__main__":
     unittest.main()