From 4d797f17f37451e66cd1b185538cc7961ea021bc Mon Sep 17 00:00:00 2001
From: Jonathon Lynn Duerig <duerig@flux.utah.edu>
Date: Tue, 13 May 2008 20:33:44 +0000
Subject: [PATCH] Made signatures optional. Changed <capability_name> to
 <name>. Fixed test1.xml and test2.xml to fulfill this new schema as per
 Leigh.

---
 protogeni/security/credential.rnc |  4 ++--
 protogeni/security/credential.xsd |  6 +++---
 protogeni/security/test1.xml      |  6 ++++--
 protogeni/security/test2.xml      | 16 +++++++++-------
 4 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/protogeni/security/credential.rnc b/protogeni/security/credential.rnc
index 5bde5aa9fe..78b9d6f3ca 100644
--- a/protogeni/security/credential.rnc
+++ b/protogeni/security/credential.rnc
@@ -26,7 +26,7 @@ include "../rspec/protogeni-rspec-common.rnc"
 ## Representation of a single capability. 
 CapabilitySpec = element capability {
 	# Name of the capability. 
-	element capability_name { xsd:string { minLength = "1" }},
+	element name { xsd:string { minLength = "1" }},
 	# Flag indicating this capability can be delegated
         element can_delegate { xsd:boolean }
 }
@@ -74,7 +74,7 @@ credentials = element credential {
 
 SignedCredential = element signed-credential {
     credentials,
-    signatures
+    signatures?
 }
 
 start = SignedCredential
diff --git a/protogeni/security/credential.xsd b/protogeni/security/credential.xsd
index db739ba1cb..f96e4293a7 100644
--- a/protogeni/security/credential.xsd
+++ b/protogeni/security/credential.xsd
@@ -32,12 +32,12 @@
   <xs:element name="capability">
     <xs:complexType>
       <xs:sequence>
-        <xs:element ref="credential:capability_name"/>
+        <xs:element ref="credential:name"/>
         <xs:element name="can_delegate" type="xs:boolean"/>
       </xs:sequence>
     </xs:complexType>
   </xs:element>
-  <xs:element name="capability_name">
+  <xs:element name="name">
     <xs:simpleType>
       <xs:restriction base="xs:string">
         <xs:minLength value="1"/>
@@ -143,7 +143,7 @@
       <xs:complexContent>
         <xs:extension base="credential:credentials">
           <xs:sequence>
-            <xs:element ref="credential:signatures"/>
+            <xs:element minOccurs="0" ref="credential:signatures"/>
           </xs:sequence>
         </xs:extension>
       </xs:complexContent>
diff --git a/protogeni/security/test1.xml b/protogeni/security/test1.xml
index 640e80e366..3168def252 100644
--- a/protogeni/security/test1.xml
+++ b/protogeni/security/test1.xml
@@ -1,13 +1,15 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<signed-credential xmlns="http://www.protogeni.net/resources/credential/0.1" xmlns:sig="http://www.w3.org/2000/09/xmldsig#">
 <credential xml:id="Ref1">
   <type>capability</type>
+  <serial>0</serial>
   <owner_uuid>foo bar</owner_uuid>
   <this_uuid>foo bar</this_uuid>
   <capabilities>
     <capability>
-      <capability_name>frazzle</capability_name>
+      <name>frazzle</name>
       <can_delegate>1</can_delegate>
     </capability>
   </capabilities>
 </credential>
-
+</signed-credential>
diff --git a/protogeni/security/test2.xml b/protogeni/security/test2.xml
index f39c59c5d4..e6393677dc 100644
--- a/protogeni/security/test2.xml
+++ b/protogeni/security/test2.xml
@@ -1,27 +1,29 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<signed-credential>
+<signed-credential xmlns="http://www.protogeni.net/resources/credential/0.1" xmlns:sig="http://www.w3.org/2000/09/xmldsig#">
   <credential xml:id="Ref2">
   <type>capability</type>
+  <serial>2</serial>
   <owner_uuid>foo bar</owner_uuid>
   <this_uuid>foo bar</this_uuid>
   <capabilities>
     <capability>
-      <capability_name>frazzle</capability_name>
+      <name>frazzle</name>
       <can_delegate>1</can_delegate>
     </capability>
     <capability>
-      <capability_name>drazzle</capability_name>
+      <name>drazzle</name>
       <can_delegate>1</can_delegate>
     </capability>
   </capabilities>
   <parent>
   <credential xml:id="Ref1">
   <type>capability</type>
+  <serial>3</serial>
   <owner_uuid>foo bar</owner_uuid>
   <this_uuid>foo bar</this_uuid>
   <capabilities>
     <capability>
-      <capability_name>frazzle</capability_name>
+      <name>frazzle</name>
       <can_delegate>1</can_delegate>
     </capability>
   </capabilities>
@@ -46,9 +48,9 @@ kDDvwDHIkP8WlWF+Pk1NJNZRpmUFLtPdRG2DTWG/ySwp8UBJRLgkSno7N5ULmbxm
 pA74Pi0YLOq2yLJpdm+HdDa1uqpI7YSgMSPoEUqTVX0=</SignatureValue>
  <KeyInfo>
   <X509Data>
-   
-   
-   
+
+
+
   <X509Certificate>MIIEAzCCA2ygAwIBAgIBADANBgkqhkiG9w0BAQQFADCBuDELMAkGA1UEBhMCVVMx
 DTALBgNVBAgTBFV0YWgxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR0wGwYDVQQK
 ExRVdGFoIE5ldHdvcmsgVGVzdGJlZDEeMBwGA1UECxMVQ2VydGlmaWNhdGUgQXV0
-- 
GitLab