Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ecsec Public
reqesidta-prototype
client-signer
Commits
bed826fa
Commit
bed826fa
authored
Oct 23, 2019
by
Tobias Wich
Browse files
Merge branch 'result-minor-activate'
parents
4561cae9
6fac7641
Changes
17
Expand all
Show whitespace changes
Inline
Side-by-side
addon/src/main/java/org/openecard/addon/bind/AuxDataKeys.java
View file @
bed826fa
...
...
@@ -36,5 +36,6 @@ public class AuxDataKeys {
public
static
final
String
REDIRECT_LOCATION
=
PREFIX
+
"redirect_location"
;
public
static
final
String
RESPONSE_HEADERS
=
PREFIX
+
"response_headers"
;
public
static
final
String
MINOR_PROCESS_RESULT
=
PREFIX
+
"minor_result"
;
}
addons/tr03112/src/main/java/org/openecard/binding/tctoken/PAOSTask.java
View file @
bed826fa
...
...
@@ -111,7 +111,11 @@ public class PAOSTask implements Callable<StartPAOSResponse> {
sp
.
getSupportedDIDProtocols
().
addAll
(
supportedDIDs
);
return
p
.
sendStartPAOS
(
sp
);
}
finally
{
try
{
TCTokenHandler
.
disconnectHandle
(
dispatcher
,
connectionHandle
);
}
catch
(
Exception
ex
)
{
LOG
.
warn
(
"Error disconnecting finished handle."
,
ex
);
}
}
}
...
...
addons/tr03112/src/main/java/org/openecard/binding/tctoken/TCTokenHandler.java
View file @
bed826fa
...
...
@@ -375,22 +375,35 @@ public class TCTokenHandler {
break
;
}
LOG
.
debug
(
"Processing InnerException."
,
innerException
);
if
(
innerException
instanceof
WSException
)
{
WSException
ex
=
(
WSException
)
innerException
;
errorMsg
=
createResponseFromWsEx
(
ex
,
response
);
}
else
if
(
innerException
instanceof
PAOSConnectionException
)
{
response
.
setResult
(
WSHelper
.
makeResultError
(
ResultMinor
.
TRUSTED_CHANNEL_ESTABLIS
C
HMENT_FAILED
,
response
.
setResult
(
WSHelper
.
makeResultError
(
ResultMinor
.
TRUSTED_CHANNEL_ESTABLISHMENT_FAILED
,
w
.
getLocalizedMessage
()));
response
.
setAdditionalResultMinor
(
ECardConstants
.
Minor
.
Disp
.
COMM_ERROR
);
}
else
if
(
innerException
instanceof
InterruptedException
)
{
response
.
setResultCode
(
BindingResultCode
.
INTERRUPTED
);
response
.
setResult
(
WSHelper
.
makeResultError
(
ResultMinor
.
CANCELLATION_BY_USER
,
errorMsg
));
response
.
setAdditionalResultMinor
(
ECardConstants
.
Minor
.
App
.
SESS_TERMINATED
);
}
else
if
(
innerException
instanceof
DocumentValidatorException
)
{
errorMsg
=
LANG_TR
.
translationForKey
(
SCHEMA_VALIDATION_FAILED
);
// it is ridiculous, that this should be a client error, but the test spec demands this
response
.
setResult
(
WSHelper
.
makeResultError
(
ResultMinor
.
CLIENT_ERROR
,
w
.
getMessage
()));
response
.
setAdditionalResultMinor
(
ECardConstants
.
Minor
.
SAL
.
Support
.
SCHEMA_VAILD_FAILED
);
}
else
{
errorMsg
=
createMessageFromUnknownError
(
w
);
response
.
setResult
(
WSHelper
.
makeResultError
(
ResultMinor
.
CLIENT_ERROR
,
w
.
getMessage
()));
response
.
setAdditionalResultMinor
(
ECardConstants
.
Minor
.
App
.
UNKNOWN_ERROR
);
}
String
paosAdditionalMinor
=
w
.
getAdditionalResultMinor
();
if
(
paosAdditionalMinor
!=
null
)
{
LOG
.
debug
(
"Replacing minor from inner exception with minor from PAOSException."
);
LOG
.
debug
(
"InnerException minor: {}"
,
response
.
getAuxResultData
().
get
(
AuxDataKeys
.
MINOR_PROCESS_RESULT
));
LOG
.
debug
(
"PAOSException minor: {}"
,
paosAdditionalMinor
);
response
.
setAdditionalResultMinor
(
paosAdditionalMinor
);
}
showErrorMessage
(
errorMsg
);
...
...
@@ -548,7 +561,10 @@ public class TCTokenHandler {
private
String
createResponseFromWsEx
(
WSException
ex
,
TCTokenResponse
response
)
{
String
errorMsg
;
switch
(
ex
.
getResultMinor
())
{
String
minor
=
ex
.
getResultMinor
();
switch
(
minor
)
{
case
ECardConstants
.
Minor
.
Disp
.
TIMEOUT
:
case
ECardConstants
.
Minor
.
SAL
.
CANCELLATION_BY_USER
:
case
ECardConstants
.
Minor
.
IFD
.
CANCELLATION_BY_USER
:
errorMsg
=
LANG_TOKEN
.
translationForKey
(
"cancel"
);
...
...
@@ -594,6 +610,9 @@ public class TCTokenHandler {
errorMsg
=
LANG_TR
.
translationForKey
(
ERROR_WHILE_AUTHENTICATION
);
response
.
setResult
(
WSHelper
.
makeResultError
(
ResultMinor
.
SERVER_ERROR
,
errorMsg
));
}
response
.
setAdditionalResultMinor
(
minor
);
return
errorMsg
;
}
...
...
addons/tr03112/src/main/java/org/openecard/binding/tctoken/TCTokenResponse.java
View file @
bed826fa
/****************************************************************************
* Copyright (C) 2012-201
4
ecsec GmbH.
* Copyright (C) 2012-201
9
ecsec GmbH.
* All rights reserved.
* Contact: ecsec GmbH (info@ecsec.de)
*
...
...
@@ -42,10 +42,12 @@ import org.openecard.common.util.UrlBuilder;
*
* @author Moritz Horsch
* @author Hans-Martin Haase
* @author Tobias Wich
*/
public
class
TCTokenResponse
extends
BindingResult
{
private
static
final
I18n
lang
=
I18n
.
getTranslation
(
"tr03112"
);
private
static
final
I18n
LANG
=
I18n
.
getTranslation
(
"tr03112"
);
private
Result
result
;
private
TCToken
token
;
private
Future
<?>
bindingTask
;
...
...
@@ -71,6 +73,10 @@ public class TCTokenResponse extends BindingResult {
this
.
result
=
result
;
}
public
void
setAdditionalResultMinor
(
String
minor
)
{
this
.
addAuxResultData
(
AuxDataKeys
.
MINOR_PROCESS_RESULT
,
minor
);
}
/**
* Sets the TCToken as received in the request.
*
...
...
@@ -151,7 +157,7 @@ public class TCTokenResponse extends BindingResult {
}
catch
(
URISyntaxException
ex
)
{
// this is a code failure as the URLs are verified upfront
// TODO: translate when exception changes
throw
new
IllegalArgumentException
(
lang
.
getOriginalMessage
(
INVALID_URL
),
ex
);
throw
new
IllegalArgumentException
(
LANG
.
getOriginalMessage
(
INVALID_URL
),
ex
);
}
}
...
...
addons/tr03112/src/main/java/org/openecard/binding/tctoken/TCTokenVerifier.java
View file @
bed826fa
...
...
@@ -396,7 +396,7 @@ public class TCTokenVerifier {
}
URI
refreshUrlAsUrl
=
createUrlWithErrorParams
(
refreshUrl
,
ResultMinor
.
TRUSTED_CHANNEL_ESTABLIS
C
HMENT_FAILED
,
ex
.
getMessage
());
ResultMinor
.
TRUSTED_CHANNEL_ESTABLISHMENT_FAILED
,
ex
.
getMessage
());
throw
new
InvalidTCTokenElement
(
refreshUrlAsUrl
.
toString
(),
ex
);
}
catch
(
IOException
|
HttpResourceException
|
InvalidUrlException
|
InvalidProxyException
|
ValidationError
|
URISyntaxException
ex1
)
{
String
errorUrl
=
token
.
getComErrorAddressWithParams
(
ResultMinor
.
COMMUNICATION_ERROR
);
...
...
addons/tr03112/src/main/java/org/openecard/binding/tctoken/ex/ResultMinor.java
View file @
bed826fa
...
...
@@ -33,7 +33,7 @@ public class ResultMinor {
/**
* Indicates that the eID-Client failed to set up a trusted channel to the eID-Server.
*/
public
static
final
String
TRUSTED_CHANNEL_ESTABLIS
C
HMENT_FAILED
=
"trustedChannelEstablishmentFailed"
;
public
static
final
String
TRUSTED_CHANNEL_ESTABLISHMENT_FAILED
=
"trustedChannelEstablishmentFailed"
;
/**
* Indicates that the user aborted the authentication.
...
...
addons/tr03112/src/main/java/org/openecard/sal/protocol/eac/ChipAuthenticationStep.java
View file @
bed826fa
...
...
@@ -30,9 +30,9 @@ import org.openecard.addon.sal.FunctionType;
import
org.openecard.addon.sal.ProtocolStep
;
import
org.openecard.binding.tctoken.TR03112Keys
;
import
org.openecard.common.DynamicContext
;
import
org.openecard.common.ECardException
;
import
org.openecard.common.WSHelper
;
import
org.openecard.common.interfaces.Dispatcher
;
import
org.openecard.common.sal.protocol.exception.ProtocolException
;
import
org.openecard.common.tlv.TLVException
;
import
org.openecard.sal.protocol.eac.anytype.EAC2OutputType
;
import
org.openecard.sal.protocol.eac.anytype.EACAdditionalInputType
;
...
...
@@ -92,7 +92,11 @@ public class ChipAuthenticationStep implements ProtocolStep<DIDAuthenticate, DID
eac2Output
=
auth
.
performAuth
(
eac2Output
,
internalData
);
response
.
setAuthenticationProtocolData
(
eac2Output
.
getAuthDataType
());
}
catch
(
ParserConfigurationException
|
ProtocolException
|
TLVException
e
)
{
}
catch
(
ECardException
e
)
{
LOG
.
error
(
e
.
getMessage
(),
e
);
response
.
setResult
(
e
.
getResult
());
dynCtx
.
put
(
EACProtocol
.
AUTHENTICATION_DONE
,
false
);
}
catch
(
ParserConfigurationException
|
TLVException
e
)
{
LOG
.
error
(
e
.
getMessage
(),
e
);
response
.
setResult
(
WSHelper
.
makeResultUnknownError
(
e
.
getMessage
()));
dynCtx
.
put
(
EACProtocol
.
AUTHENTICATION_DONE
,
false
);
...
...
addons/tr03112/src/main/java/org/openecard/sal/protocol/eac/PACEStep.java
View file @
bed826fa
...
...
@@ -46,6 +46,7 @@ import org.openecard.binding.tctoken.TR03112Keys;
import
org.bouncycastle.tls.TlsServerCertificate
;
import
org.openecard.common.DynamicContext
;
import
org.openecard.common.ECardConstants
;
import
org.openecard.common.ECardException
;
import
org.openecard.common.I18n
;
import
org.openecard.common.ThreadTerminateException
;
import
org.openecard.common.WSHelper
;
...
...
@@ -299,6 +300,7 @@ public class PACEStep implements ProtocolStep<DIDAuthenticate, DIDAuthenticateRe
switch
(
minor
)
{
case
ECardConstants
.
Minor
.
IFD
.
CANCELLATION_BY_USER
:
case
ECardConstants
.
Minor
.
SAL
.
CANCELLATION_BY_USER
:
case
ECardConstants
.
Minor
.
Disp
.
TIMEOUT
:
needsTermination
=
true
;
}
}
...
...
@@ -391,7 +393,7 @@ public class PACEStep implements ProtocolStep<DIDAuthenticate, DIDAuthenticateRe
String
msg
=
ex
.
getMessage
();
response
.
setResult
(
WSHelper
.
makeResultError
(
ECardConstants
.
Minor
.
SAL
.
EAC
.
DOC_VALID_FAILED
,
msg
));
dynCtx
.
put
(
EACProtocol
.
AUTHENTICATION_DONE
,
false
);
}
catch
(
WSHelper
.
WS
Exception
e
)
{
}
catch
(
ECard
Exception
e
)
{
LOG
.
error
(
e
.
getMessage
(),
e
);
response
.
setResult
(
e
.
getResult
());
dynCtx
.
put
(
EACProtocol
.
AUTHENTICATION_DONE
,
false
);
...
...
addons/tr03112/src/main/java/org/openecard/sal/protocol/eac/TerminalAuthenticationStep.java
View file @
bed826fa
...
...
@@ -30,6 +30,7 @@ import org.openecard.addon.sal.ProtocolStep;
import
org.openecard.binding.tctoken.TR03112Keys
;
import
org.openecard.common.DynamicContext
;
import
org.openecard.common.ECardConstants
;
import
org.openecard.common.ECardException
;
import
org.openecard.common.WSHelper
;
import
org.openecard.common.interfaces.Dispatcher
;
import
org.openecard.crypto.common.asn1.cvc.CardVerifiableCertificate
;
...
...
@@ -136,6 +137,10 @@ public class TerminalAuthenticationStep implements ProtocolStep<DIDAuthenticate,
}
response
.
setAuthenticationProtocolData
(
eac2Output
.
getAuthDataType
());
}
catch
(
ECardException
e
)
{
LOG
.
error
(
e
.
getMessage
(),
e
);
response
.
setResult
(
e
.
getResult
());
dynCtx
.
put
(
EACProtocol
.
AUTHENTICATION_DONE
,
false
);
}
catch
(
Exception
e
)
{
LOG
.
error
(
e
.
getMessage
(),
e
);
response
.
setResult
(
WSHelper
.
makeResultUnknownError
(
e
.
getMessage
()));
...
...
addons/tr03112/src/main/java/org/openecard/sal/protocol/eac/gui/ProcessingStepAction.java
View file @
bed826fa
...
...
@@ -72,7 +72,7 @@ public class ProcessingStepAction extends StepAction {
}
catch
(
TimeoutException
ex
)
{
LOG
.
info
(
"Timeout while waiting for the authentication to finish."
,
ex
);
ctx
.
put
(
EACProtocol
.
PACE_EXCEPTION
,
WSHelper
.
createException
(
WSHelper
.
makeResultError
(
ECardConstants
.
Minor
.
SAL
.
CANCELLATION_BY_USER
,
"User canceled the EAC dialog
."
)));
ECardConstants
.
Minor
.
Disp
.
TIMEOUT
,
"Timeout during EAC process
."
)));
return
new
StepActionResult
(
StepActionResultStatus
.
CANCEL
);
}
}
...
...
addons/tr03112/src/main/java/org/openecard/transport/paos/PAOS.java
View file @
bed826fa
...
...
@@ -329,6 +329,7 @@ public class PAOS {
DefaultConnectionReuseStrategy
reuse
=
new
DefaultConnectionReuseStrategy
();
boolean
connectionDropped
=
false
;
ResponseBaseType
lastResponse
=
null
;
String
firstOecMinorError
=
null
;
try
{
// loop and send makes a computer happy
...
...
@@ -344,6 +345,16 @@ public class PAOS {
// save the last message we sent to the eID-Server.
if
(
msg
instanceof
ResponseBaseType
)
{
lastResponse
=
(
ResponseBaseType
)
msg
;
// save first minor code if there is one returned from our stack
if
(
firstOecMinorError
==
null
)
{
Result
r
=
lastResponse
.
getResult
();
if
(
r
!=
null
)
{
String
minor
=
r
.
getResultMinor
();
if
(
minor
!=
null
)
{
firstOecMinorError
=
minor
;
}
}
}
}
// prepare request
String
resource
=
tlsHandler
.
getResource
();
...
...
@@ -451,7 +462,11 @@ public class PAOS {
}
catch
(
TransformerException
ex
)
{
throw
new
DispatcherException
(
ex
);
}
catch
(
WSException
ex
)
{
throw
new
PAOSException
(
ex
);
PAOSException
newEx
=
new
PAOSException
(
ex
);
if
(
firstOecMinorError
!=
null
)
{
newEx
.
setAdditionalResultMinor
(
firstOecMinorError
);
}
throw
newEx
;
}
finally
{
try
{
if
(
conn
!=
null
)
{
...
...
addons/tr03112/src/main/java/org/openecard/transport/paos/PAOSException.java
View file @
bed826fa
...
...
@@ -38,6 +38,8 @@ public class PAOSException extends I18nException {
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
I18n
lang
=
I18n
.
getTranslation
(
"tr03112"
);
private
String
additionalResultMinor
;
/**
* Creates an instance and initializes the exception with a cause.
*
...
...
@@ -78,4 +80,12 @@ public class PAOSException extends I18nException {
super
(
lang
,
key
,
cause
,
params
);
}
public
void
setAdditionalResultMinor
(
String
additionalResultMinor
)
{
this
.
additionalResultMinor
=
additionalResultMinor
;
}
public
String
getAdditionalResultMinor
()
{
return
additionalResultMinor
;
}
}
clients/android-lib/src/main/java/org/openecard/android/activation/ActivationController.java
View file @
bed826fa
...
...
@@ -138,6 +138,9 @@ public class ActivationController {
default
:
activationResult
=
new
ActivationResult
(
INTERNAL_ERROR
,
result
.
getResultMessage
());
}
activationResult
.
setProcessMinor
(
result
.
getAuxResultData
().
get
(
AuxDataKeys
.
MINOR_PROCESS_RESULT
));
return
activationResult
;
}
...
...
clients/android-lib/src/main/java/org/openecard/android/activation/ActivationResult.java
View file @
bed826fa
...
...
@@ -32,6 +32,7 @@ public class ActivationResult {
private
final
String
redirectUrl
;
private
final
ActivationResultCode
resultCode
;
private
final
String
errorMessage
;
private
String
processMinor
;
public
ActivationResult
(
ActivationResultCode
resultCode
)
{
this
(
null
,
resultCode
,
null
);
...
...
@@ -51,6 +52,10 @@ public class ActivationResult {
this
.
errorMessage
=
errorMessage
;
}
public
void
setProcessMinor
(
String
processMinor
)
{
this
.
processMinor
=
processMinor
;
}
public
String
getRedirectUrl
()
{
return
redirectUrl
;
}
...
...
@@ -63,4 +68,14 @@ public class ActivationResult {
return
errorMessage
;
}
/**
* If present, represents the minor error code of the error leading to the termination of the process.
*
* @see ECardConstants.Minor;
* @return The minor result code or {@code null} if not present.
*/
public
String
getProcessResultMinor
()
{
return
processMinor
;
}
}
common/src/main/java/org/openecard/common/ECardConstants.java
View file @
bed826fa
This diff is collapsed.
Click to expand it.
ifd/ifd-protocols/pace/src/main/java/org/openecard/ifd/protocol/pace/PACEImplementation.java
View file @
bed826fa
...
...
@@ -25,6 +25,7 @@ package org.openecard.ifd.protocol.pace;
import
java.security.GeneralSecurityException
;
import
java.util.List
;
import
org.openecard.common.ECardConstants
;
import
org.openecard.common.WSHelper
;
import
org.openecard.common.apdu.GeneralAuthenticate
;
import
org.openecard.common.apdu.common.CardCommandAPDU
;
import
org.openecard.common.apdu.common.CardResponseAPDU
;
...
...
@@ -135,7 +136,7 @@ public class PACEImplementation {
if
(
e
.
getCause
()
instanceof
Exception
)
{
throw
(
Exception
)
e
.
getCause
();
}
else
{
throw
new
ProtocolException
(
ECardConstants
.
Minor
.
IFD
.
UNKNOWN_ERROR
,
e
.
getMessage
());
throw
new
ProtocolException
(
e
.
getResultMinor
()
,
e
.
getMessage
());
}
}
...
...
ifd/ifd-protocols/pace/src/main/java/org/openecard/ifd/protocol/pace/PACEProtocol.java
View file @
bed826fa
...
...
@@ -26,6 +26,7 @@ import iso.std.iso_iec._24727.tech.schema.EstablishChannel;
import
iso.std.iso_iec._24727.tech.schema.EstablishChannelResponse
;
import
java.io.UnsupportedEncodingException
;
import
org.openecard.common.ECardConstants
;
import
org.openecard.common.ECardException
;
import
org.openecard.common.WSHelper
;
import
org.openecard.common.apdu.common.CardResponseAPDU
;
import
org.openecard.common.apdu.utils.CardUtils
;
...
...
@@ -121,7 +122,7 @@ public class PACEProtocol implements Protocol {
response
.
setResult
(
WSHelper
.
makeResultError
(
ECardConstants
.
Minor
.
IFD
.
IO
.
UNKNOWN_PIN_FORMAT
,
"Cannot encode the PIN in "
+
PACEConstants
.
PIN_CHARSET
+
" charset."
));
}
catch
(
Protocol
Exception
ex
)
{
}
catch
(
ECard
Exception
ex
)
{
logger
.
error
(
ex
.
getMessage
(),
ex
);
response
.
setResult
(
WSHelper
.
makeResult
(
ex
));
}
catch
(
Throwable
ex
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment