[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ease-dev] [EASE] Sign and Verify Script
|
Hi,
I have prepared more scripts with valid/invalid signature and this time in python and _javascript_.
Scripts are available here.
Format of signature is like this:
- At the end of script, a new line is added
- For _javascript_, Signature will start with /********BEGIN SIGNATURE********
- For python: """*****BEGIN SIGNSTURE********
- Then a signature in Base64 format is added
- A new line is added
- Certificate is encoded in Base64 and added
- A new line is added
- For _javascript_, Signature ends with ********END SIGNATURE********/
- For python: ********BEGIN SIGNSTURE*****"""
At
time of verification, if there is any change in above format,
IOException is thrown and signature format will be considered invalid
and signature verification will fail.
(a.) Original script is
before new line added in first step above. So, for verification, this
new line has to be excluded. So, malicious user might change this new
line and add scripts instead. This needs to be prevented.
Following are the causes due to which signature verification will fail i.e. signature is invalid
- Script modified after adding signature
- Script added in new line. see (a.)
- Starting line is in improper format
- A line is missing after signature
- Script is added after end of signature block
- signature or certificate blocks are modified
(1) will cause verification error. i.e. signature is false
(2), (3), (4), (5) will throw IOException.
(6) may cause IOException or verification error depending upon how it is modified
I
am looking for more ways by which signature verification may fail. It
would be great if someone can point out those I am missing.
These scripts are signed by code that is written by me, available here. Core methods available here.
I would like to generate more test data from some other signing utility
but I am not able to find any. So if anyone knows about any other
utility, I will be happy to use.
getSign(), getCert(), getContent() methods in Extract_Sign_Cert_Content.java file are used to extract signature, certificate and main content over which signature is applied from script file.
Sample signature with python script is attached here.
Thanks,
Hi Varun,
Looks neat. I like the signature embedded in the script.
As the resident Python advocate I just wanted to point out that the comment format will need to be language dependent. Fortunately there are already some utilities in EASE to deal with comments, so have a look at org.eclipse.ease.ICodeParser and org.eclipse.ease.ICodeFactory, perhaps extending them as needed if the functionality you need isn't there.
_______________________________________________
ease-dev mailing list
ease-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/ease-dev
--
Varun Raval
# ****************************************************************************
# Copyright (c) 2015 UT-Battelle, LLC.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Initial API and implementation and/or initial documentation - Kasper
# Gammeltoft, Jay Jay Billings
#
# This is an example script designed to show how to use ease with ICE. It
# creates a new Reflectivity Model and processes it, but also edits the input
# to the table beforehand.
# ****************************************************************************
# Load the Platform module for accessing OSGi services
loadModule('/System/Platform')
# Get the core service from ICE for creating and accessing objects.
coreService = getService(org.eclipse.ice.core.iCore.ICore);
# Create the reflectivity model to be used and get its reference. The create item
# method will return a string representing the number of that item, so use int() to
# convert it to an integer.
reflectModel = coreService.getItem(int(coreService.createItem("Reflectivity Model")))
# Gets the list component used as the data for the table (is on tab 2)
listComp = reflectModel.getComponent(2)
# Gets the third material and sets its thickness to 400
mat1 = listComp.get(2)
mat1.setProperty("Thickness (A)", 400)
# Get the total thickness and set the second material's thickness to depend
# on the thicknesses of the other materials
totThickness = 0
for i in xrange(0, listComp.size() - 1):
if(i != 1):
totThickness += listComp.get(i).getProperty("Thickness (A)")
# Set the thickness of the second material so that the total sums to 1000 (A)
listComp.get(1).setProperty("Thickness (A)", 1000-totThickness);
# Finally process the model to get the results.
coreService.processItem(reflectModel.getId(), "Calculate Reflectivity", 1);
"""*****BEGIN SIGNSTURE********
MCwCFDP1HQOlr4RAVyvnApNb1weM2A6wAhRGI0FV1insKLVPG8iIHPwOh0gNEQ==
MIIDNzCCAvWgAwIBAgIELNrJgDALBgcqhkjOOAQDBQAwbTEL
MAkGA1UEBhMCSU4xEDAOBgNVBAgTB0d1amFyYXQxEjAQBgNV
BAcTCUFobWVkYWJhZDEQMA4GA1UEChMHVW5rbm93bjEQMA4G
A1UECxMHVW5rbm93bjEUMBIGA1UEAxMLVmFydW4gUmF2YWww
HhcNMTYwMzA1MTE1NjUwWhcNMTYwNjAzMTE1NjUwWjBtMQsw
CQYDVQQGEwJJTjEQMA4GA1UECBMHR3V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