java/remoteprovisioning/EekCertChainSerializer.java
/*
   * Builds a random EEK certificate chain with a provided X25519 public key as the EEK.
   *
   * @return a CBOR encoded EEK certificate chain byte array
   */
Builds a random EEK certificate chain with a provided X25519 public key as the EEK.
@return a CBOR encoded EEK certificate chain byte array
Builds a random EEK certificate chain with a provided X25519 public key as the EEK . @return a CBOR encoded EEK certificate chain byte array
public static byte[] generateEekChain(X25519PublicKeyParameters eek) throws CryptoException {
    try {
      OneKey eekRootKeyPair = OneKey.generateKey(KeyKeys.OKP_Ed25519);
      eekRootKeyPair.add(KeyKeys.Algorithm, AlgorithmID.EDDSA.AsCBOR());
      OneKey eekIntKeyPair = OneKey.generateKey(KeyKeys.OKP_Ed25519);
      eekIntKeyPair.add(KeyKeys.Algorithm, AlgorithmID.EDDSA.AsCBOR());
      CBORObject certArray = CBORObject.NewArray();
      certArray.Add(
          CryptoUtil.createCertificateEd25519(eekRootKeyPair, eekRootKeyPair.PublicKey()));
      certArray.Add(CryptoUtil.createCertificateEd25519(eekRootKeyPair, eekIntKeyPair.PublicKey()));
      certArray.Add(CryptoUtil.createCertificateEd25519(eekIntKeyPair, eek));
      return certArray.EncodeToBytes();
    } catch (CoseException e) {
      throw new CryptoException(
          "Could not generate Ed25519 Key Pair.", e, CryptoException.KEY_GENERATION_FAILURE);
    }
  }
public static byte [ ] generateEekChain ( X25519PublicKeyParameters eek ) throws CryptoException { try { OneKey eekRootKeyPair = OneKey . generateKey ( KeyKeys . OKP_Ed25519 ) ; eekRootKeyPair . add ( KeyKeys . Algorithm , AlgorithmID . EDDSA . AsCBOR ( ) ) ; OneKey eekIntKeyPair = OneKey . generateKey ( KeyKeys . OKP_Ed25519 ) ; eekIntKeyPair . add ( KeyKeys . Algorithm , AlgorithmID . EDDSA . AsCBOR ( ) ) ; CBORObject certArray = CBORObject . NewArray ( ) ; certArray . Add ( CryptoUtil . createCertificateEd25519 ( eekRootKeyPair , eekRootKeyPair . PublicKey ( ) ) ) ; certArray . Add ( CryptoUtil . createCertificateEd25519 ( eekRootKeyPair , eekIntKeyPair . PublicKey ( ) ) ) ; certArray . Add ( CryptoUtil . createCertificateEd25519 ( eekIntKeyPair , eek ) ) ; return certArray . EncodeToBytes ( ) ; } catch ( CoseException e ) { throw new CryptoException ( "Could not generate Ed25519 Key Pair." , e , CryptoException . KEY_GENERATION_FAILURE ) ; } }
Builds a random EEK certificate chain with a provided X25519 public key as the EEK.
Builds a random EEK certificate chain with a provided X25519 public key as the EEK .