Search in sources :

Example 1 with MultiRemoteAttestationResponse

use of org.whispersystems.signalservice.internal.contacts.entities.MultiRemoteAttestationResponse in project Signal-Android by WhisperSystems.

the class RemoteAttestationUtil method getAndVerifyMultiRemoteAttestation.

public static Map<String, RemoteAttestation> getAndVerifyMultiRemoteAttestation(PushServiceSocket socket, PushServiceSocket.ClientSet clientSet, KeyStore iasKeyStore, String enclaveName, String mrenclave, String authorization) throws IOException, Quote.InvalidQuoteFormatException, InvalidCiphertextException, UnauthenticatedQuoteException, SignatureException, InvalidKeyException {
    ECKeyPair keyPair = buildKeyPair();
    ResponsePair result = makeAttestationRequest(socket, clientSet, authorization, enclaveName, keyPair);
    MultiRemoteAttestationResponse response = JsonUtil.fromJson(result.body, MultiRemoteAttestationResponse.class);
    Map<String, RemoteAttestation> attestations = new HashMap<>();
    if (response.getAttestations().isEmpty() || response.getAttestations().size() > 3) {
        throw new MalformedResponseException("Incorrect number of attestations: " + response.getAttestations().size());
    }
    for (Map.Entry<String, RemoteAttestationResponse> entry : response.getAttestations().entrySet()) {
        attestations.put(entry.getKey(), validateAndBuildRemoteAttestation(entry.getValue(), result.cookies, iasKeyStore, keyPair, mrenclave));
    }
    return attestations;
}
Also used : RemoteAttestation(org.whispersystems.signalservice.internal.contacts.crypto.RemoteAttestation) HashMap(java.util.HashMap) MultiRemoteAttestationResponse(org.whispersystems.signalservice.internal.contacts.entities.MultiRemoteAttestationResponse) RemoteAttestationResponse(org.whispersystems.signalservice.internal.contacts.entities.RemoteAttestationResponse) ECKeyPair(org.whispersystems.libsignal.ecc.ECKeyPair) MalformedResponseException(org.whispersystems.signalservice.api.push.exceptions.MalformedResponseException) MultiRemoteAttestationResponse(org.whispersystems.signalservice.internal.contacts.entities.MultiRemoteAttestationResponse) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with MultiRemoteAttestationResponse

use of org.whispersystems.signalservice.internal.contacts.entities.MultiRemoteAttestationResponse in project Signal-Android by signalapp.

the class RemoteAttestationUtil method getAndVerifyMultiRemoteAttestation.

public static Map<String, RemoteAttestation> getAndVerifyMultiRemoteAttestation(PushServiceSocket socket, PushServiceSocket.ClientSet clientSet, KeyStore iasKeyStore, String enclaveName, String mrenclave, String authorization) throws IOException, Quote.InvalidQuoteFormatException, InvalidCiphertextException, UnauthenticatedQuoteException, SignatureException, InvalidKeyException {
    ECKeyPair keyPair = buildKeyPair();
    ResponsePair result = makeAttestationRequest(socket, clientSet, authorization, enclaveName, keyPair);
    MultiRemoteAttestationResponse response = JsonUtil.fromJson(result.body, MultiRemoteAttestationResponse.class);
    Map<String, RemoteAttestation> attestations = new HashMap<>();
    if (response.getAttestations().isEmpty() || response.getAttestations().size() > 3) {
        throw new MalformedResponseException("Incorrect number of attestations: " + response.getAttestations().size());
    }
    for (Map.Entry<String, RemoteAttestationResponse> entry : response.getAttestations().entrySet()) {
        attestations.put(entry.getKey(), validateAndBuildRemoteAttestation(entry.getValue(), result.cookies, iasKeyStore, keyPair, mrenclave));
    }
    return attestations;
}
Also used : RemoteAttestation(org.whispersystems.signalservice.internal.contacts.crypto.RemoteAttestation) HashMap(java.util.HashMap) MultiRemoteAttestationResponse(org.whispersystems.signalservice.internal.contacts.entities.MultiRemoteAttestationResponse) RemoteAttestationResponse(org.whispersystems.signalservice.internal.contacts.entities.RemoteAttestationResponse) ECKeyPair(org.whispersystems.libsignal.ecc.ECKeyPair) MalformedResponseException(org.whispersystems.signalservice.api.push.exceptions.MalformedResponseException) MultiRemoteAttestationResponse(org.whispersystems.signalservice.internal.contacts.entities.MultiRemoteAttestationResponse) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)2 Map (java.util.Map)2 ECKeyPair (org.whispersystems.libsignal.ecc.ECKeyPair)2 MalformedResponseException (org.whispersystems.signalservice.api.push.exceptions.MalformedResponseException)2 RemoteAttestation (org.whispersystems.signalservice.internal.contacts.crypto.RemoteAttestation)2 MultiRemoteAttestationResponse (org.whispersystems.signalservice.internal.contacts.entities.MultiRemoteAttestationResponse)2 RemoteAttestationResponse (org.whispersystems.signalservice.internal.contacts.entities.RemoteAttestationResponse)2