File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
src/main/java/ee/cyber/cdoc2/crypto/jwt Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -475,6 +475,35 @@ List<String> extractedFiles = new CDocDecrypter()
475475 .decrypt();
476476```
477477
478+
479+ ### User interaction with Smart ID and Mobile ID clients
480+ Smart ID and Mobile ID clients interact with user by display messages and verification code.
481+ Available interactions are implemented in a class ` InteractionParams ` , which can be of
482+ following types ` InteractionParams.InteractionType ` :
483+ * DISPLAY_TEXT_AND_PIN
484+ * CONFIRMATION_MESSAGE
485+ * VERIFICATION_CODE_CHOICE
486+ * CONFIRMATION_MESSAGE_AND_VERIFICATION_CODE_CHOICE
487+
488+ Initialized ` InteractionParams ` will be transferred to Smart ID and Mobile ID clients while
489+ authenticating.
490+
491+ ` InteractionParams ` can be configured by initializing ` KeyShareDecryptionKeyMaterial `
492+ with method ` InteractionParamsConfigurable.init() ` while decrypting:
493+ ``` java
494+ private static void addInteractionParameters(File cdocFile, DecryptionKeyMaterial dkm) {
495+ if (dkm instanceof InteractionParamsConfigurable paramsConfigurable) {
496+
497+ InteractionParams interactionParams = (cdocFile == null )
498+ ? InteractionParams . displayTextAndPin()
499+ : InteractionParams . displayTextAndVCCForDocument(cdocFile. toPath(). getFileName(). toString());
500+ interactionParams. addAuthListener(e - > System . out. println(" Verification code:" + e. getVerificationCode()));
501+ paramsConfigurable. init(interactionParams);
502+ }
503+ }
504+ ```
505+
506+
478507## Long-term crypto
479508
480509Scenarios with id-card are meant for transport cryptography only as id-card certificates expiry and
Original file line number Diff line number Diff line change 77import java .util .LinkedList ;
88import java .util .List ;
99
10+
1011/**
1112 * Smart-ID and Mobile-ID interaction parameters.
1213 * Optional parameters to drive user interaction and to get verification code.
@@ -28,7 +29,6 @@ public enum InteractionType {
2829 CONFIRMATION_MESSAGE_AND_VERIFICATION_CODE_CHOICE
2930 }
3031
31-
3232 /** Default text for Smart-ID. Max length 60 chars. Default text for MID is defined in mobile-id.properties */
3333 public static final String DEFAULT_DISPLAY_TEXT = "Authenticate to decrypt CDOC2 document" ;
3434
@@ -119,7 +119,6 @@ public void setEncoding(String encoding) {
119119 this .encoding = encoding ;
120120 }
121121
122-
123122 /** Get text displayed. If text is longer than 200 chars, will be capped to 200 chars */
124123 public String getDisplayText200 () {
125124 return getDisplayText (200 );
@@ -160,4 +159,5 @@ public void notifyAuthListeners(AuthEvent event) {
160159 listener .authStarted (event );
161160 }
162161 }
162+
163163}
You can’t perform that action at this time.
0 commit comments