Exemplo n.º 1
0
 def testUsingTestData(self):
   """Test for signature_method_from_string() using test data"""
   new_signature_method = ds.signature_method_from_string(
     ds_data.TEST_SIGNATURE_METHOD)
   assert isinstance(new_signature_method.hmac_output_length,
                           ds.SignatureMethodType_HMACOutputLength)
   assert new_signature_method.hmac_output_length.text.strip() == "8"
   assert new_signature_method.algorithm == ds.SIG_RSA_SHA1
Exemplo n.º 2
0
 def testAccessors(self):
   """Test for SignatureMethod accessors"""
   self.signature_method.algorithm = ds.SIG_RSA_SHA1
   self.signature_method.hmac_output_length = ds.SignatureMethodType_HMACOutputLength(text="8")
   new_signature_method = ds.signature_method_from_string(
     self.signature_method.to_string())
   assert isinstance(new_signature_method.hmac_output_length,
                           ds.SignatureMethodType_HMACOutputLength)
   assert new_signature_method.hmac_output_length.text.strip() == "8"
   assert new_signature_method.algorithm == ds.SIG_RSA_SHA1
Exemplo n.º 3
0
 def testAccessors(self):
   """Test for SignedInfo accessors"""
   self.si.id = "id"
   self.si.canonicalization_method = ds.canonicalization_method_from_string(
     ds_data.TEST_CANONICALIZATION_METHOD)
   self.si.signature_method = ds.signature_method_from_string(
     ds_data.TEST_SIGNATURE_METHOD)
   self.si.reference.append(ds.reference_from_string(
     ds_data.TEST_REFERENCE))
   new_si = ds.signed_info_from_string(self.si.to_string())
   assert new_si.id == "id"
   assert isinstance(new_si.canonicalization_method,
                           ds.CanonicalizationMethod)
   assert isinstance(new_si.signature_method, ds.SignatureMethod)
   assert isinstance(new_si.reference[0], ds.Reference)