From 9e1335af0ab4a4169def73ce7281f31f292b8756 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Fri, 30 Sep 2022 12:15:03 +0200 Subject: Revert "fido2 proof of concept" (it should've probably been on a feature branch) This reverts commit fd24a56578a323715b844b610ba91a3bfd400342. --- .../asit/pdfover/gui/bku/MobileBKUConnector.java | 55 ---------------------- 1 file changed, 55 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java index 09255956..9b7e4d09 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/MobileBKUConnector.java @@ -15,15 +15,10 @@ */ package at.asit.pdfover.gui.bku; -import java.util.Base64; - // Imports import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.gson.JsonNull; -import com.google.gson.JsonObject; - import at.asit.pdfover.commons.Constants; import at.asit.pdfover.gui.bku.mobile.ATrustHandler; import at.asit.pdfover.gui.bku.mobile.ATrustStatus; @@ -35,11 +30,6 @@ import at.asit.pdfover.signator.SLRequest; import at.asit.pdfover.signator.SLResponse; import at.asit.pdfover.signator.SignatureException; import at.asit.pdfover.signer.pdfas.PdfAs4SigningState; -import at.asit.webauthn.PublicKeyCredential; -import at.asit.webauthn.PublicKeyCredentialRequestOptions; -import at.asit.webauthn.WebAuthN; -import at.asit.webauthn.exceptions.WebAuthNOperationFailed; -import at.asit.webauthn.responsefields.AuthenticatorAssertionResponse; /** * @@ -136,51 +126,6 @@ public class MobileBKUConnector implements BkuSlConnector { if (status instanceof ATrustStatus) { ATrustStatus aStatus = (ATrustStatus) status; ATrustHandler aHandler = (ATrustHandler) handler; - if (aStatus.fido2OptionAvailable && (aStatus.fido2FormOptions == null)) { - try { - handler.handleCredentialsResponse(aHandler.postFIDO2Request()); - } catch (Exception ex) { - log.error("Error in PostCredentialsThread", ex); - this.state.threadException = ex; - throw new SignatureException(ex); - } - } - if (aStatus.fido2FormOptions != null) { - log.info("Fido2 credentials GET!"); - if (WebAuthN.isAvailable()) - { - log.info("Authenticating with WebAuthn!"); - enterTAN = false; - try { - PublicKeyCredential credential = - PublicKeyCredentialRequestOptions.FromJSONString(aStatus.fido2FormOptions.get(aStatus.fido2OptionsKey)).get("https://service.a-trust.at"); - - Base64.Encoder base64 = Base64.getEncoder(); - JsonObject aTrustCredential = new JsonObject(); - aTrustCredential.addProperty("id", credential.id); - aTrustCredential.addProperty("rawId", base64.encodeToString(credential.rawId)); - aTrustCredential.addProperty("type", credential.type); - aTrustCredential.add("extensions", new JsonObject()); // TODO fix getClientExtensionResults() in library - - JsonObject aTrustCredentialResponse = new JsonObject(); - aTrustCredential.add("response", aTrustCredentialResponse); - aTrustCredentialResponse.addProperty("authenticatorData", base64.encodeToString(credential.response.authenticatorData)); - aTrustCredentialResponse.addProperty("clientDataJson", base64.encodeToString(credential.response.clientDataJSON)); - aTrustCredentialResponse.addProperty("signature", base64.encodeToString(credential.response.signature)); - if (credential.response.userHandle != null) - aTrustCredentialResponse.addProperty("userHandle", base64.encodeToString(credential.response.userHandle)); - else - aTrustCredentialResponse.add("userHandle", JsonNull.INSTANCE); - - aStatus.fido2FormOptions.put(aStatus.fido2ResultKey, aTrustCredential.toString()); - handler.handleTANResponse(aHandler.postFIDO2Result()); // TODO dedicated response - } catch (WebAuthNOperationFailed e) { - log.error("WebAuthN failed", e); - } catch (Exception e) { - log.error("generic failure", e); - } - } - } if (aStatus.qrCodeURL != null) { this.state.showQR(); if ("cancel".equals(this.state.status.errorMessage)) -- cgit v1.2.3