public class RIoT extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RIoT.DeviceAuthBundle
Container for PEM-encoded keys and certificates created by the RIoT Emulator
|
Constructor and Description |
---|
RIoT() |
Modifier and Type | Method and Description |
---|---|
static RIoT.DeviceAuthBundle |
CreateDeviceAuthBundle(byte[] UDS,
byte[] FWID,
boolean createCSR)
The RIoT Emulator.
|
static RIoT.DeviceAuthBundle |
CreateDeviceAuthBundle(byte[] UDS,
byte[] FWID,
boolean createCSR,
String rCN,
String dCN,
String aCN)
The RIoT Emulator.
|
static void |
CreateLeafCert(RIoT.DeviceAuthBundle devAuth,
String commonName)
Create a certificate proving possession of the root key.
|
static KeyPair |
DeriveEccKey(byte[] srcData)
Create an ECC key pair deterministically based on the provided source data
|
static byte[] |
Hash(byte[] buf)
Hashing function for RIoT emulation (SHA256)
|
static byte[] |
Hash(byte[] buf1,
byte[] buf2)
Hash function for DICE emulation (SHA256)
|
public static void CreateLeafCert(RIoT.DeviceAuthBundle devAuth, String commonName)
devAuth
- An initialized DeviceAuthBundle containing DICE/RIoT keys and certscommonName
- The "verifier" string from the DPS to be inserted in the cert's TBS datapublic static RIoT.DeviceAuthBundle CreateDeviceAuthBundle(byte[] UDS, byte[] FWID, boolean createCSR, String rCN, String dCN, String aCN)
UDS
- The Unique Device Secret for this emulated "device"FWID
- The Firmware ID (e.g., the measurement of the firmware image) on this emulated "device"createCSR
- Indicates whether a Certificate Signing Request should be generatedrCN
- String to provide as Subject Common Name in "root" CA Key CertificatedCN
- String to provide as Subject Common Name in DeviceID Key CertificateaCN
- String to provide as Subject Common Name in Alias Key Certificatepublic static RIoT.DeviceAuthBundle CreateDeviceAuthBundle(byte[] UDS, byte[] FWID, boolean createCSR)
UDS
- The Unique Device Secret for this emulated "device"FWID
- The Firmware ID (e.g., the measurement of the firmware image) on this emulated "device"createCSR
- Indicates whether a Certificate Signing Request should be generatedpublic static KeyPair DeriveEccKey(byte[] srcData) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException
srcData
- The seed for key derivationNoSuchAlgorithmException
- Problem with rSignAlgNoSuchProviderException
- Problem with BC providerInvalidAlgorithmParameterException
- Problem with rEcCurvepublic static byte[] Hash(byte[] buf) throws NoSuchAlgorithmException
buf
- Byte buffer from which digest is computedNoSuchAlgorithmException
- When no "SHA-256"public static byte[] Hash(byte[] buf1, byte[] buf2) throws NoSuchAlgorithmException
buf1
- First byte buffer to be included in digestbuf2
- Second byte buffer to be included in digestNoSuchAlgorithmException
- When no "SHA-256"Copyright © 2017. All rights reserved.