示例#1
0
 public static void addNeighborhoodToDSSK(DD_SK d_SK, D_Neighborhood neighborhood) {
   if (neighborhood == null) return;
   for (D_Neighborhood n : d_SK.neigh) {
     if (n == neighborhood) return;
     if (n.getLID() == neighborhood.getLID()) return;
   }
   d_SK.neigh.add(neighborhood);
   // new D_Witness(a,b,c,e);// must avoid recursive adding of neighborhoods from constituents
 }
示例#2
0
 @Override
 public DD_SK decode(Decoder dec) throws ASN1DecoderFail {
   String default_orgGID = null;
   String default_orgGIDH = null;
   Decoder d = dec.getContent();
   if (d.getTypeByte() == DD.TAG_AP0)
     version = d.getFirstObject(true).getInteger(DD.TAG_AP0).intValue();
   if (d.getTypeByte() == DD.TAG_AC0)
     sk = d.getFirstObject(true).getSequenceOfAL(DD_SK_Entry.getASN1Tag(), new DD_SK_Entry());
   if (d.getTypeByte() == DD.TAG_AC1)
     peer = d.getFirstObject(true).getSequenceOfAL(D_Peer.getASN1Type(), D_Peer.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC2) {
     org =
         d.getFirstObject(true)
             .getSequenceOfAL(D_Organization.getASN1Type(), D_Organization.getEmpty());
     if (org.size() == 1) {
       default_orgGID = org.get(0).getGID();
       default_orgGIDH = org.get(0).getGIDH();
       if (DEBUG)
         System.out.println(
             "DD_SK: has a GID for orgs: " + default_orgGID + " H=" + default_orgGIDH);
     }
   }
   if (d.getTypeByte() == DD.TAG_AC3)
     neigh =
         d.getFirstObject(true)
             .getSequenceOfAL(D_Neighborhood.getASN1Type(), D_Neighborhood.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC4)
     constit =
         d.getFirstObject(true)
             .getSequenceOfAL(D_Constituent.getASN1Type(), D_Constituent.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC5)
     witn = d.getFirstObject(true).getSequenceOfAL(D_Witness.getASN1Type(), D_Witness.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC6) {
     moti = d.getFirstObject(true).getSequenceOfAL(D_Motion.getASN1Type(), D_Motion.getEmpty());
     for (D_Motion m : moti) {
       if (m.getOrganizationGIDH() == null) {
         if (_DEBUG) System.out.println("DD_SK: put a GIDH for " + m);
         m.setOrganizationGID(default_orgGIDH);
         if (_DEBUG) System.out.println("DD_SK: did put a GIDH for " + m);
       } else if (DEBUG) System.out.println("DD_SK: had a GIDH for " + m);
     }
   }
   if (d.getTypeByte() == DD.TAG_AC7)
     just =
         d.getFirstObject(true)
             .getSequenceOfAL(D_Justification.getASN1Type(), D_Justification.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC8)
     vote = d.getFirstObject(true).getSequenceOfAL(D_Vote.getASN1Type(), D_Vote.getEmpty());
   if (d.getTypeByte() == DD.TAG_AC10)
     tran =
         d.getFirstObject(true)
             .getSequenceOfAL(D_Translations.getASN1Type(), D_Translations.getEmpty());
   if (d.getTypeByte() == DD.TAG_AP1) sender = D_Peer.getEmpty().decode(d.getFirstObject(true));
   if (d.getTypeByte() == DD.TAG_AP2) signature = d.getFirstObject(true).getBytes(DD.TAG_AP2);
   return this;
 }