diff --git a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/NFC/Comms.java b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/NFC/Comms.java index e9cce29..a4d184b 100644 --- a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/NFC/Comms.java +++ b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/NFC/Comms.java @@ -95,6 +95,10 @@ public class Comms { keyMAC = keys[1]; } + public byte[] getAuthenticationCertificate() { + return new byte[0]; + } + /** * Calculates the message authentication code * diff --git a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/Authenticator.kt b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/Authenticator.kt new file mode 100644 index 0000000..a92d716 --- /dev/null +++ b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/Authenticator.kt @@ -0,0 +1,22 @@ +package com.tarkvaraprojekt.mobileauthapp.auth + +import android.nfc.tech.IsoDep +import com.tarkvaraprojekt.mobileauthapp.NFC.Comms +import java.math.BigInteger + +class Authenticator(val comms : Comms) { + + public fun authenticate(nonce: BigInteger, challengeUrl: String, pin1: String) { + + // Ask PIN 1 from the user and get the authentication certificate from the ID card. + val authenticationCertificate : ByteArray = comms.getAuthenticationCertificate(); + + // Create the authentication token (OpenID X509) + + // Hash the authentication token. + + // Send the authentication token hash to the ID card for signing and get signed authentication token as response. + + // Return the signed authentication token. + } +} \ No newline at end of file