-
Notifications
You must be signed in to change notification settings - Fork 17
/
SmartIdSignature.java
97 lines (80 loc) · 2.95 KB
/
SmartIdSignature.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package ee.sk.smartid;
/*-
* #%L
* Smart ID sample Java client
* %%
* Copyright (C) 2018 SK ID Solutions AS
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* #L%
*/
import ee.sk.smartid.exception.UnprocessableSmartIdResponseException;
import java.io.Serializable;
import java.util.Base64;
public class SmartIdSignature implements Serializable {
private String valueInBase64;
private String algorithmName;
private String documentNumber;
private String interactionFlowUsed;
private String deviceIpAddress;
public byte[] getValue() {
try {
return Base64.getDecoder().decode(valueInBase64);
}
catch (IllegalArgumentException ie) {
throw new UnprocessableSmartIdResponseException("Failed to parse signature value in base64. Probably incorrectly encoded base64 string: '" + valueInBase64);
}
}
public String getValueInBase64() {
return valueInBase64;
}
public void setValueInBase64(String valueInBase64) {
this.valueInBase64 = valueInBase64;
}
public String getAlgorithmName() {
return algorithmName;
}
public void setAlgorithmName(String algorithmName) {
this.algorithmName = algorithmName;
}
public String getDocumentNumber() {
return documentNumber;
}
public void setDocumentNumber(String documentNumber) {
this.documentNumber = documentNumber;
}
public String getInteractionFlowUsed() {
return interactionFlowUsed;
}
public void setInteractionFlowUsed(String interactionFlowUsed) {
this.interactionFlowUsed = interactionFlowUsed;
}
/**
* IP address of the device running the App.
* Present only for subscribed RPs and when available (e.g. not present in case state is TIMEOUT).
*
* @return IP address of the device running Smart-id app (or null if not returned)
*/
public String getDeviceIpAddress() {
return deviceIpAddress;
}
public void setDeviceIpAddress(String deviceIpAddress) {
this.deviceIpAddress = deviceIpAddress;
}
}