Commit 22ccf05a authored by garciay's avatar garciay
Browse files

Bug fixed in verify signature

parent 59215f8a
......@@ -237,12 +237,14 @@ public class GnPort extends ProtocolPort implements Runnable, IEthernetSpecific
);
/* boolean result = CryptoLib.verifyWithEcdsaNistp256WithSha256(p_toBeSignedData, signatureBytes, management.getSigningPublicKeyX(), management.getSigningPublicKeyY());
//TERFactory.getInstance().logDebug("GnPort.signSecuredMessage: Verify signature: pubX" + ByteHelper.byteArrayToString(management.getSigningPublicKeyX()));
//TERFactory.getInstance().logDebug("GnPort.signSecuredMessage: Verify signature: pubY" + ByteHelper.byteArrayToString(management.getSigningPublicKeyY()));
//TERFactory.getInstance().logDebug("GnPort.signSecuredMessage: Verify signature: " + new Boolean(result));*/
// //TERFactory.getInstance().logDebug("<<< GnPort.signSecuredMessage: sendBeacon: " + ByteHelper.byteArrayToString(securedBeaconHeader));
if (management.isEnforceSecuredModeSet()) {
boolean result = CryptoLib.verifyWithEcdsaNistp256WithSha256(p_toBeSignedData, signatureBytes, management.getSigningPublicKeyX(), management.getSigningPublicKeyY());
//TERFactory.getInstance().logDebug("GnPort.signSecuredMessage: Verify signature: pubX" + ByteHelper.byteArrayToString(management.getSigningPublicKeyX()));
//TERFactory.getInstance().logDebug("GnPort.signSecuredMessage: Verify signature: pubY" + ByteHelper.byteArrayToString(management.getSigningPublicKeyY()));
//TERFactory.getInstance().logDebug("GnPort.signSecuredMessage: Verify signature: " + new Boolean(result));*/
//TERFactory.getInstance().logDebug("<<< GnPort.signSecuredMessage: sendBeacon: " + ByteHelper.byteArrayToString(securedBeaconHeader));
return (result) ? securedBeaconHeader : null;
}
return securedBeaconHeader;
} catch (Exception e) {
e.printStackTrace();
......
......@@ -353,11 +353,10 @@ public class UpperTesterPort extends AdapterPort implements IPort, IObservable {
);
TERFactory.getInstance().logDebug("UpperTesterPort.checkSecuredOtherProfileAndExtractPayload:" + ByteHelper.byteArrayToString(toBeVerifiedData));
// Calculate Digest digest from the buffer toBeVerifiedData
byte[] hash = CryptoLib.hashWithSha256(toBeVerifiedData);
boolean result;
try {
result = CryptoLib.verifyWithEcdsaNistp256WithSha256(
hash,
toBeVerifiedData,
signature.toByteArray(),
aaSigningPublicKeyX,
aaSigningPublicKeyY
......@@ -366,7 +365,6 @@ public class UpperTesterPort extends AdapterPort implements IPort, IObservable {
if (!result) {
// Drop packet
TERFactory.getInstance().logDebug("UpperTesterPort.checkSecuredOtherProfileAndExtractPayload: toBeVerifiedData :" + ByteHelper.byteArrayToString(toBeVerifiedData));
TERFactory.getInstance().logDebug("UpperTesterPort.checkSecuredOtherProfileAndExtractPayload: Hash :" + ByteHelper.byteArrayToString(hash));
TERFactory.getInstance().logDebug("UpperTesterPort.checkSecuredOtherProfileAndExtractPayload: signature :" + ByteHelper.byteArrayToString(signature.toByteArray()));
TERFactory.getInstance().logDebug("UpperTesterPort.checkSecuredOtherProfileAndExtractPayload: aaSigningPublicKeyX:" + ByteHelper.byteArrayToString(aaSigningPublicKeyX));
TERFactory.getInstance().logDebug("UpperTesterPort.checkSecuredOtherProfileAndExtractPayload: aaSigningPublicKeyY:" + ByteHelper.byteArrayToString(aaSigningPublicKeyY));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment