Generate SoftWare IDentification (SWID) Tags according to ISO/IEC 19770-2:2015
SoftWare IDentification (SWID) Tags record unique information about an installed software application, including its name, edition, version, whether it’s part of a bundle and more. SWID tags support software inventory and asset management initiatives. The structure of SWID tags is specified in international standard ISO/IEC 19770-2:2015.
The recommended way to get started using swid-generator
in your project is by adding it as dependency in your build system:
Maven:
<dependencies>
<dependency>
<groupId>com.labs64.utils</groupId>
<artifactId>swid-generator</artifactId>
<version>x.y.z</version>
</dependency>
</dependencies>
Gradle:
dependencies {
compile 'com.labs64.utils:swid-generator:x.y.z'
}
To generate SoftWare IDentification (SWID) Tag (gist):
// prepare SWID Tag processor
DefaultSwidProcessor processor = new DefaultSwidProcessor();
processor.setGenerator(new SequentialIdGenerator(0, 1, "e", null));
processor.setName("NetLicensing")
.setVersion("2.1.0")
.setVersionScheme(VersionScheme.UNKNOWN)
.setSupplemental(true)
.addEntity(new EntityBuilder().name("Labs64")
.role("softwareCreator")
.role("softwareLicensor")
.role("tagCreator")
.build())
.addLink(new LinkBuilder().rel("supplemental")
.href("swid:other-swid-tag")
.build())
.addMetaData(new SoftwareMetaBuilder().description("This is what it's about")
.entitlementDataRequired(true)
.revision("3")
.build())
.addEvidence(new EvidenceBuilder()
.deviceId("123-a")
.date(new Date())
.directoryOrFileOrProcess(new FileBuilder()
.name("File.xml")
.size(BigInteger.TEN)
.version("3")
.build())
.build())
.addPayload(new PayloadBuilder()
.directory(new DirectoryBuilder()
.root("/data")
.key(true)
.location("/folder")
.build())
.build());
// create builder and pass processor as build param
SwidBuilder builder = new SwidBuilder();
SoftwareIdentity swidTag = builder.build(processor);
// output resulting object
SwidWriter writer = new SwidWriter();
StringWriter out = new StringWriter();
writer.write(swidTag, out);
System.out.println(out);
...this generates the following SoftWare IDentification (SWID) Tag:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<SoftwareIdentity name="NetLicensing" supplemental="true" tagId="e_1" version="2.1.0" versionScheme="unknown" xmlns="http://standards.iso.org/iso/19770/-2/2014-DIS/schema.xsd" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#">
<Entity name="Labs64" role="softwareCreator softwareLicensor tagCreator"/>
<Link href="swid:other-swid-tag" rel="supplemental"/>
<Meta description="This is what it's about" entitlementDataRequired="true" revision="3"/>
<Evidence date="2020-04-24Z" xml:lang="123-a">
<File name="File.xml" size="10" version="3"/>
</Evidence>
<Payload>
<Directory key="true" location="/folder" root="/data"/>
</Payload>
</SoftwareIdentity>
This library requires J2SE 1.8 or newer. All dependencies handled by Maven.
- Spec: IT asset management — Part 2: Software Identification Tag: https://www.iso.org/standard/65666.html
- SoftWare IDentification (SWID) Tags Generator (Maven Plugin): https://github.com/Labs64/swid-maven-plugin
Fork the repository and make some changes. Once you're done with your changes send a pull request and check CI validation status. Thanks!
Thank you to all the contributors on this project. Your help is much appreciated!
- Labs64 NetLicensing - Innovative License Management Solution
- GuideChimp - A simple, lightweight, clean and small library for creating guided product tours for your web app.
- @henryean - Upgrade library to the next specification version ISO/IEC 19770-2:2015
For bugs, questions and discussions please use the GitHub Issues.
This library is open-sourced software licensed under the Apache License 2.0.