Projet

Général

Profil

« Précédent | Suivant » 

Révision bf9c3717

Ajouté par Remy Menard il y a environ 11 ans

Version 1.99

  • All:
    - a few bugs fixed!
  • New web application LaMBDa
  • ETa:
    - new testing application to capture events
  • SigMa-Test:
    - new options to the command line to configure the public/private keys
    for TLS and for signature
  • ALfA, OMeGa:
    - new method more accurate than "traceEPC": the events are sorted by
    EPCIS
  • OmICroN:
    - New options added to the command line
  • YPSilon, EpcisPHI:
    - user can be identified by alias, if the DN of his certificate is
    incompatible with the LDAP directory
  • YPSilon:
    - new shell script to configure the LDAP directory (same
    functionnalities as IoTa-Installer)
  • IoTa-Installer:
    - installs and configures LaMBDa
    - finer certificate mangagement
    - EpcILoN correctly subscribe with TLS to ETa
  • Greyc letters figures:
    - new figure for LaMBDa
    - shows data flows between PHI and YPSilon
    - sets DS and DSeTa in different schemas

Voir les différences:

SigMa/SigMa-Commons/src/main/java/fr/unicaen/iota/sigma/SigMaFunctions.java
log.debug(cForm);
String signature = createECDSASignature(cForm);
Utils.insertExtension(event, Constants.URN_IOTA, Constants.EXTENSION_SIGNATURE, signature);
Utils.insertExtension(event, Constants.URN_IOTA, Constants.EXTENSION_SIGNER_ID, signerId);
String cForm2 = createCanonicalForm(event);
log.debug(cForm2);
}
......
CertificateException, UnrecoverableKeyException, JAXBException, TransformerConfigurationException, TransformerException {
this.signerId = signerId;
String cForm = createCanonicalForm(event);
log.info(cForm);
log.debug(cForm);
String signature = createECDSASignature(cForm);
Utils.insertExtension(event, Constants.URN_IOTA, Constants.EXTENSION_SIGNATURE, signature);
Utils.insertExtension(event, Constants.URN_IOTA, Constants.EXTENSION_SIGNER_ID, signerId);
String cForm2 = createCanonicalForm(event);
log.info(cForm2);
log.debug(cForm2);
}
/**
* Verify a signature of an EPCISEventType.
*
* @param event the signed event.
* @return <code>true</code> if the siganture is correct.
* @return <code>true</code> if the signature is correct.
* @throws FileNotFoundException
* @throws CertificateException
* @throws NoSuchAlgorithmException
......
String signature = getSignature(event);
deleteSignature(event);
String cForm = createCanonicalForm(event);
log.info(cForm);
log.debug(cForm);
PublicKey publicKey = getPublicKey();
Signature ecdsa = Signature.getInstance("SHA1withECDSA");
ecdsa.initVerify(publicKey);
......
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JAXBContext jc = JAXBContext.newInstance(AggregationEventType.class);
Marshaller m = jc.createMarshaller();
m.marshal(event, baos);
m.marshal(new JAXBElement<AggregationEventType>(new QName("", "AggregationEvent"),
AggregationEventType.class, event), baos);
byte[] nonCanonicalXML = baos.toByteArray();
Node node = byteArrayToNode(nonCanonicalXML);
byte[] canonicalXML = canonicalizeXML(node);
......
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JAXBContext jc = JAXBContext.newInstance(ObjectEventType.class);
Marshaller m = jc.createMarshaller();
m.marshal(event, baos);
m.marshal(new JAXBElement<ObjectEventType>(new QName("", "ObjectEvent"),
ObjectEventType.class, event), baos);
byte[] nonCanonicalXML = baos.toByteArray();
Node node = byteArrayToNode(nonCanonicalXML);
byte[] canonicalXML = canonicalizeXML(node);
......
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JAXBContext jc = JAXBContext.newInstance(QuantityEventType.class);
Marshaller m = jc.createMarshaller();
m.marshal(event, baos);
m.marshal(new JAXBElement<QuantityEventType>(new QName("", "QuantityEvent"),
QuantityEventType.class, event), baos);
byte[] nonCanonicalXML = baos.toByteArray();
Node node = byteArrayToNode(nonCanonicalXML);
byte[] canonicalXML = canonicalizeXML(node);
......
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JAXBContext jc = JAXBContext.newInstance(TransactionEventType.class);
Marshaller m = jc.createMarshaller();
m.marshal(event, baos);
m.marshal(new JAXBElement<TransactionEventType>(new QName("", "TransactionEvent"),
TransactionEventType.class, event), baos);
byte[] nonCanonicalXML = baos.toByteArray();
Node node = byteArrayToNode(nonCanonicalXML);
byte[] canonicalXML = canonicalizeXML(node);
......
PrivateKey privateKey = null;
char[] password = keyStorePassword.toCharArray();
KeyStore ks = getKeyStore(keyStoreFilePath);
if (this.signerId == null) {
if (this.signerId == null || this.signerId.isEmpty()) {
Enumeration<String> en = ks.aliases();
while (en.hasMoreElements()) {
String alias = en.nextElement();
if (ks.isKeyEntry(alias)) {
......
private PublicKey getPublicKey() throws KeyStoreException, FileNotFoundException, IOException,
NoSuchAlgorithmException, CertificateException {
KeyStore ks = getKeyStore(keyStoreFilePath);
PublicKey publicKey = null;
Enumeration<String> en = ks.aliases();
// TODO: hard value
publicKey = ks.getCertificate(this.signerId).getPublicKey();
if (this.signerId == null || this.signerId.isEmpty()) {
Enumeration<String> en = ks.aliases();
while (en.hasMoreElements()) {
String alias = en.nextElement();
if (ks.isKeyEntry(alias)) {
this.signerId = alias;
break;
}
}
}
PublicKey publicKey = ks.getCertificate(this.signerId).getPublicKey();
return publicKey;
}
......
return null;
}
for (Object object : extensions) {
// we really don’t know what’s in an extension
// JAXBElement elem = (JAXBElement) object;
// if (("signature".equals(elem.getName().getLocalPart()))) {
// signature = elem.getValue().toString();
// }
Element elem = (Element) object;
if ((Constants.URN_IOTA.equals(elem.getNamespaceURI()) && Constants.EXTENSION_SIGNATURE.equals(elem.getLocalName()))) {
signature = elem.getTextContent().toString();
......
Element elem = null;
for (Object object : extensions) {
// we really don’t know what’s in an extension
// JAXBElement elemTmp = (JAXBElement) object;
// if (("signature".equals(elemTmp.getName().getLocalPart()))) {
// elem = elemTmp;
// break;
// }
Element elemTmp = (Element) object;
if ((Constants.URN_IOTA.equals(elemTmp.getNamespaceURI()) && Constants.EXTENSION_SIGNATURE.equals(elemTmp.getLocalName()))) {
elem = elemTmp;
......
}
private String getSignerId(EPCISEventType event) {
String signerId = "";
String signId = "";
List<Object> extensions;
if (event instanceof ObjectEventType) {
......
return null;
}
for (Object object : extensions) {
// we really don’t know what’s in an extension
// JAXBElement elem = (JAXBElement) object;
// if (("signature".equals(elem.getName().getLocalPart()))) {
// signature = elem.getValue().toString();
// }
Element elem = (Element) object;
if ((Constants.URN_IOTA.equals(elem.getNamespaceURI()) && Constants.EXTENSION_SIGNER_ID.equals(elem.getLocalName()))) {
signerId = elem.getTextContent().toString();
signId = elem.getTextContent().toString();
}
}
return signerId;
return signId;
}
private void deleteSignerId(EPCISEventType event) {
......
Element elem = null;
for (Object object : extensions) {
// we really don’t know what’s in an extension
// JAXBElement elemTmp = (JAXBElement) object;
// if (("signature".equals(elemTmp.getName().getLocalPart()))) {
// elem = elemTmp;
// break;
// }
Element elemTmp = (Element) object;
if ((Constants.URN_IOTA.equals(elemTmp.getNamespaceURI()) && Constants.EXTENSION_SIGNER_ID.equals(elemTmp.getLocalName()))) {
elem = elemTmp;

Formats disponibles : Unified diff