Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate Element Names in Archive File object #340

Open
nemonik opened this issue Dec 12, 2014 · 5 comments
Open

Duplicate Element Names in Archive File object #340

nemonik opened this issue Dec 12, 2014 · 5 comments

Comments

@nemonik
Copy link
Contributor

nemonik commented Dec 12, 2014

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>
@nemonik
Copy link
Contributor Author

nemonik commented Dec 15, 2014

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

@nemonik
Copy link
Contributor Author

nemonik commented Feb 24, 2015

Where are we with this?

@gtback gtback changed the title To generate the simple JAXB2 DOM for java-stix I had to patch Duplicate Elements in Archive File object Feb 25, 2015
@gtback
Copy link
Contributor

gtback commented Feb 25, 2015

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.

@ikiril01
Copy link
Member

Updated title slightly for accuracy.

@ikiril01 ikiril01 changed the title Duplicate Elements in Archive File object Duplicate Element Names in Archive File object May 19, 2015
@ikiril01
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants