CybOXProject / schemas

CybOX Schemas and Schema Development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duplicate Element Names in Archive File object

nemonik opened this issue · comments

Both "Encryption_Algorithm" and "Decryption_Key" appear in the Archive_File_Object.xsd when they already are declared in the File_Object.xsd schema. This causes problems.

See patch below.

--- src/main/resources/schemas/cybox/objects/Archive_File_Object.xsd    2014-12-10 15:08:05.000000000 -0500
+++ src/main/resources/schemas/cybox/objects/Patched_Archive_File_Object.xsd    2014-12-11 12:21:38.000000000 -0500
@@ -39,16 +39,6 @@
                             <xs:documentation>The File_Count field specifies the number of files contained within the archive.</xs:documentation>
                         </xs:annotation>
                     </xs:element>
-                    <xs:element minOccurs="0" name="Encryption_Algorithm" type="cyboxCommon:CipherType">
-                        <xs:annotation>
-                            <xs:documentation>The Encryption_Algorithm field specifies the algorithm used to encrypt an archive file.  Note: For individual files within an archive that are themselves encrypted, the specifics of that encryption are found in the FileObject definition for that file.</xs:documentation>
-                        </xs:annotation>
-                    </xs:element>
-                    <xs:element name="Decryption_Key" type="cyboxCommon:StringObjectPropertyType" minOccurs="0">
-                        <xs:annotation>
-                            <xs:documentation>The Decryption_Key field specifies the key used to decrypt the file.</xs:documentation>
-                        </xs:annotation>
-                    </xs:element>
                     <xs:element minOccurs="0" name="Comment" type="cyboxCommon:StringObjectPropertyType">
                         <xs:annotation>
                             <xs:documentation>The Comment field specifies the comment information associated with archive file.</xs:documentation>

If you clone https://github.com/nemonik/java_stix.git and comment the call to the patch near abouts line 104, and then run the gradle script XJC will fail to build the simple DOM be cause of properties "EncryptionAlgorithm" and "DecryptionKey" already being defined.

:generateJAXB
[ant:xjc] [ERROR] Property "EncryptionAlgorithm" is already defined. Use &lt;jaxb:property> to resolve this conflict.
[ant:xjc]   line 42 of file:/Users/walsh/Development/workspace/fresh_java_stix/src/main/resources/schemas/cybox/objects/Archive_File_Object.xsd
[ant:xjc] 
[ant:xjc] [ERROR] The following location is relevant to the above error
[ant:xjc]   line 131 of file:/Users/walsh/Development/workspace/fresh_java_stix/src/main/resources/schemas/cybox/objects/File_Object.xsd
[ant:xjc] 
[ant:xjc] [ERROR] Property "DecryptionKey" is already defined. Use &lt;jaxb:property> to resolve this conflict.
[ant:xjc]   line 47 of file:/Users/walsh/Development/workspace/fresh_java_stix/src/main/resources/schemas/cybox/objects/Archive_File_Object.xsd
[ant:xjc] 
[ant:xjc] [ERROR] The following location is relevant to the above error
[ant:xjc]   line 136 of file:/Users/walsh/Development/workspace/fresh_java_stix/src/main/resources/schemas/cybox/objects/File_Object.xsd
[ant:xjc] 
:generateJAXB FAILED

Where are we with this?

If it would help, I could commit this in a branch. It won't be in the "official" schemas until the next release, and even then, I'm not sure we can do it in a minor release or if it would have to be in a major release. Because the elements are defined by an xs:sequence and are in different namespaces, it's possible this change could break existing content.

Updated title slightly for accuracy.

I don't think this is really an issue of duplicate elements, just duplicate element names (even though they really reside in different namespaces). On the File Object, "Encryption_Algorithm"/"Decryption_Key" refer to the encryption of an individual file. On the Archive File Object, they refer to the encryption of the archive file itself. Thus, they serve different use cases (you might have an Archive File that's encrypted one way, and which contains one or more Files that are encrypted in a different way). My suggestion would be to simply rename "Encryption_Algorithm" and "Decryption_Key" on the Archive File Object to "Archive_Encryption_Algorithm" and "Archive_Decryption_Key", respectively.