aboutsummaryrefslogtreecommitdiff
path: root/id.server/src/at/gv
diff options
context:
space:
mode:
authorrudolf <rudolf@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-01-21 18:13:38 +0000
committerrudolf <rudolf@d688527b-c9ab-4aba-bd8d-4036d912da1d>2005-01-21 18:13:38 +0000
commitd3f610d5f4b4c43fed8ebfc0e178d4cfa65bb631 (patch)
tree37298b18705435e2b963f3b246859964ba2dcc16 /id.server/src/at/gv
parent9e76849546147f22d6293f8bf5bcbfe6cc5f5f2d (diff)
downloadmoa-id-spss-d3f610d5f4b4c43fed8ebfc0e178d4cfa65bb631.tar.gz
moa-id-spss-d3f610d5f4b4c43fed8ebfc0e178d4cfa65bb631.tar.bz2
moa-id-spss-d3f610d5f4b4c43fed8ebfc0e178d4cfa65bb631.zip
added ECDSA Key comparison
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@236 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'id.server/src/at/gv')
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/auth/validator/VerifyXMLSignatureResponseValidator.java38
1 files changed, 25 insertions, 13 deletions
diff --git a/id.server/src/at/gv/egovernment/moa/id/auth/validator/VerifyXMLSignatureResponseValidator.java b/id.server/src/at/gv/egovernment/moa/id/auth/validator/VerifyXMLSignatureResponseValidator.java
index c4c22fd02..5adbc5b3d 100644
--- a/id.server/src/at/gv/egovernment/moa/id/auth/validator/VerifyXMLSignatureResponseValidator.java
+++ b/id.server/src/at/gv/egovernment/moa/id/auth/validator/VerifyXMLSignatureResponseValidator.java
@@ -2,6 +2,7 @@ package at.gv.egovernment.moa.id.auth.validator;
import java.security.PublicKey;
import java.security.interfaces.RSAPublicKey;
+import iaik.security.ecc.ecdsa.ECPublicKey;
import iaik.asn1.structures.Name;
import iaik.utils.RFC2253NameParserException;
@@ -112,24 +113,35 @@ public class VerifyXMLSignatureResponseValidator {
X509Certificate x509Response = verifyXMLSignatureResponse.getX509certificate();
PublicKey[] pubKeysIdentityLink = (PublicKey[]) idl.getPublicKey();
- RSAPublicKey pubKeyResponse = (RSAPublicKey) x509Response.getPublicKey();
+ PublicKey pubKeySignature = x509Response.getPublicKey();
boolean found = false;
for (int i = 0; i < pubKeysIdentityLink.length; i++) {
- if (idl.getPublicKey()[i]
- instanceof java.security.interfaces.RSAPublicKey) {
- /* for (int j = 0;
- j < idl.getPublicKey()[i].getClass().getInterfaces().length;
- j++) {
- if (idl.getPublicKey()[i].getClass().getInterfaces()[j].getName()
- .equals("java.security.interfaces.RSAPublicKey")) {*/
- RSAPublicKey rsakey = (RSAPublicKey) pubKeysIdentityLink[i];
- if (rsakey.getModulus().equals(pubKeyResponse.getModulus())
- && rsakey.getPublicExponent().equals(
- pubKeyResponse.getPublicExponent()))
- found = true;
+
+ //compare RSAPublicKeys
+ if ((idl.getPublicKey()[i] instanceof java.security.interfaces.RSAPublicKey) &&
+ (pubKeySignature instanceof java.security.interfaces.RSAPublicKey)) {
+
+ RSAPublicKey rsaPubKeySignature = (RSAPublicKey) pubKeySignature;
+ RSAPublicKey rsakey = (RSAPublicKey) pubKeysIdentityLink[i];
+
+ //TODO check the usage of equals method
+ if (rsakey.getModulus().equals(rsaPubKeySignature.getModulus())
+ && rsakey.getPublicExponent().equals(rsaPubKeySignature.getPublicExponent()))
+ found = true;
}
+
+ //compare ECDSAPublicKeys
+ //TODO check implementation
+ if((idl.getPublicKey()[i] instanceof iaik.security.ecc.ecdsa.ECPublicKey) &&
+ (pubKeySignature instanceof iaik.security.ecc.ecdsa.ECPublicKey)) {
+ ECPublicKey ecdsaPubKeySignature = (ECPublicKey) pubKeySignature;
+ ECPublicKey ecdsakey = (ECPublicKey) pubKeysIdentityLink[i];
+
+ if(ecdsakey.equals(ecdsaPubKeySignature))
+ found = true;
+ }
}
if (!found)