| CREATOR | Mark Raynsford |
| DATE | 2022-07-01T12:36:21+00:00 |
| DESCRIPTION | Documentation for the Canonmill keystore. |
| IDENTIFIER | dcc7df2a-0093-4b52-8204-88d6f61395d6 |
| LANGUAGE | en |
| RIGHTS | Public Domain |
| TITLE | Canonmill User Manual |
<dependency> <groupId>com.io7m.canonmill</groupId> <artifactId>com.io7m.canonmill.core</artifactId> <version>2.1.0</version> </dependency>
| Name | Description |
|---|---|
| www.key | The private key for www.example.com |
| www.crt | The public certificate for www.example.com |
| mail.key | The private key for mail.example.com |
| mail.crt | The public certificate for mail.example.com |
<?xml version="1.0" encoding="UTF-8" ?>
<Keystore xmlns="urn:com.io7m.canonmill.keystore:1"
BaseDirectory="/etc/certs">
<Key Name="www.example.com"
File="www.key"/>
<Key Name="mail.example.com"
File="mail.key"/>
<Certificate Name="www.example.com"
File="www.crt"/>
<Certificate Name="mail.example.com"
File="mail.crt"/>
</Keystore>
final var ks =
KeyStore.getInstance("CANONMILL", new CMKeyStoreProvider());
try (var stream = Files.newInputStream(file)) {
ks.load(stream, null);
}
final KeyStore ks =
CMKeyStores.openKeyStore(Paths.get("ServerKeyStore.xml"));
final KeyStore ts =
CMKeyStores.openKeyStore(Paths.get("ServerTrustStore.xml"));
final SSLContext context =
CMKeyStores.createSSLContext(ks, ts, "TLSv1.3");
// Open server sockets, etc
CMKeyStores.reloadKeystoreFromFile(ks, Paths.get("ServerKeyStore.xml"));
CMKeyStores.reloadKeystoreFromFile(ts, Paths.get("ServerTrustStore.xml"));
CMKeyStores.reloadSSLContext(ks, ts, context);
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright © 2023 Mark Raynsford <code@io7m.com> https://www.io7m.com
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:com.io7m.canonmill.keystore:1"
xmlns:cm="urn:com.io7m.canonmill.keystore:1">
<xsd:complexType name="KeystoreElementType"
abstract="true">
<xsd:annotation>
<xsd:documentation>
The base type of elements that can appear in a keystore.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="Name"
type="xsd:string"
use="required">
<xsd:annotation>
<xsd:documentation>
The name of the keystore element.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="File"
type="xsd:string"
use="required">
<xsd:annotation>
<xsd:documentation>
The file containing data for the keystore element.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="CertificateType">
<xsd:annotation>
<xsd:documentation>
The type of certificates within a keystore.
</xsd:documentation>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="cm:KeystoreElementType"/>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="Certificate"
type="cm:CertificateType"/>
<xsd:complexType name="KeyType">
<xsd:annotation>
<xsd:documentation>
The type of keys within a keystore.
</xsd:documentation>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="cm:KeystoreElementType"/>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="Key"
type="cm:KeyType"/>
<xsd:group name="KeystoreElementGroup">
<xsd:annotation>
<xsd:documentation>
The group containing elements that can appear within a keystore.
</xsd:documentation>
</xsd:annotation>
<xsd:choice>
<xsd:element ref="cm:Certificate"/>
<xsd:element ref="cm:Key"/>
</xsd:choice>
</xsd:group>
<xsd:element name="Keystore">
<xsd:annotation>
<xsd:documentation>
The keystore element.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="0"
maxOccurs="unbounded">
<xsd:group ref="cm:KeystoreElementGroup"/>
</xsd:sequence>
<xsd:attribute name="BaseDirectory"
use="required"
type="xsd:anyURI">
<xsd:annotation>
<xsd:documentation>
The absolute path of the keystore directory.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:key name="KeyUnique">
<xsd:selector xpath="cm:Key"/>
<xsd:field xpath="@Name"/>
</xsd:key>
<xsd:key name="CertificateUnique">
<xsd:selector xpath="cm:Certificate"/>
<xsd:field xpath="@Name"/>
</xsd:key>
</xsd:element>
</xsd:schema>