All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.r3.conclave.host.internal.attestation.MockAttestationService.kt Maven / Gradle / Ivy

The newest version!
package com.r3.conclave.host.internal.attestation

import com.r3.conclave.common.internal.ByteCursor
import com.r3.conclave.common.internal.SgxQuote.reportBody
import com.r3.conclave.common.internal.SgxSignedQuote
import com.r3.conclave.common.internal.SgxSignedQuote.quote
import com.r3.conclave.common.internal.attestation.MockAttestation
import java.time.Instant

/**
 * A mock attestation service which provides fake attestations which always marks the enclave quote as insecure.
 *
 * @param isSimulation Whether the [MockAttestation.enclaveMode] property of the attestation is simulation or mock.
 */
class MockAttestationService(private val isSimulation: Boolean) : AttestationService {
    override fun attestQuote(signedQuote: ByteCursor): MockAttestation {
        return MockAttestation(Instant.now(), signedQuote[quote][reportBody].asReadOnly(), isSimulation)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy