Skip to content

Generate SoftWare IDentification (SWID) Tags according to ISO/IEC 19770-2:2015

License

Notifications You must be signed in to change notification settings

Labs64/swid-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SoftWare IDentification (SWID) Tags Generator (Java Library)

Build Status Maven Central Apache License 2.0

Generate SoftWare IDentification (SWID) Tags according to ISO/IEC 19770-2:2015

What are SWID Tags?

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.

Quick Start

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'
}

Examples

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>

Compatibility

This library requires J2SE 1.8 or newer. All dependencies handled by Maven.

Links

Contributing

Fork the repository and make some changes. Once you're done with your changes send a pull request and check CI validation status. Thanks!

Contributors and Supporters

Thank you to all the contributors on this project. Your help is much appreciated!

Bugs and Feedback

For bugs, questions and discussions please use the GitHub Issues.

License

This library is open-sourced software licensed under the Apache License 2.0.

About

Generate SoftWare IDentification (SWID) Tags according to ISO/IEC 19770-2:2015

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages