Exemple #1
0
 @Override
 protected RunTransactionalReturnData runTransactional() throws Exception {
   PrivateSignatory authorizer;
   if (statement instanceof RootContext) {
     if (!delegate.equals(statementAuthority.getAuthor(getTransaction())))
       throw new SignCommandException("Not the author");
     authorizer = delegate.getPrivateSignatory(getTransaction());
   } else {
     StatementAuthority parentAuth =
         statement.getContext(getTransaction()).getAuthority(getTransaction());
     Identifier identifier = statement.getIdentifier();
     Namespace namespace = identifier == null ? RootNamespace.instance : identifier;
     DelegateAuthorizer da =
         parentAuth.delegateAuthorizerMap(getTransaction(), namespace).get(delegate);
     if (da == null) throw new SignCommandException("Not a delegate");
     Signatory authorizer_ = da.getAuthorizer(getTransaction());
     if (authorizer_ == null) {
       authorizer = da.createAuthorizer(getTransaction());
       da.sign(getTransaction());
       da.persistenceUpdate(getTransaction());
     } else {
       if (!(authorizer_ instanceof PrivateSignatory))
         throw new SignCommandException(
             "Haven't got private data for this authorizer. Maybe try entering the passphrase?");
       authorizer = (PrivateSignatory) authorizer_;
     }
   }
   statementAuthority.createSignature(getTransaction(), authorizer);
   return null;
 }
 @Override
 protected RunTransactionalReturnData runTransactional() throws Exception {
   for (StatementAuthoritySignature signature : signatures) {
     if (signature.isValid()) {
       Statement statement = signature.getStatement(getTransaction());
       if (!(statement instanceof RootContext)) {
         ContextAuthority contextAuthority =
             statement.getContext(getTransaction()).getAuthority(getTransaction());
         if (contextAuthority != null) {
           DelegateAuthorizer da =
               contextAuthority
                   .delegateAuthorizerByAuthorizerMap(
                       getTransaction(), statement.prefix(getTransaction()))
                   .get(signature.getAuthorizer(getTransaction()));
           if (da != null) {
             if (da.isSigned() && (da.getDelegate(getTransaction()) instanceof PrivatePerson)) {
               DelegateTreeRootNode rn = da.getDelegateTreeRootNode(getTransaction());
               if (rn.isSigned()) {
                 da.addRevokedSignatureUuid(signature.getSignatureUuid());
                 da.sign(getTransaction());
                 da.persistenceUpdate(getTransaction());
               } else
                 getErr()
                     .println(
                         "Signature: "
                             + signature.getAuthorizer(getTransaction())
                             + "'s delegate tree root node is not signed");
             } else
               getErr()
                   .println(
                       "Signature: "
                           + signature.getAuthorizer(getTransaction())
                           + " non-revokable");
           } else
             getErr()
                 .println(
                     "Signature: "
                         + signature.getAuthorizer(getTransaction())
                         + " has no delegate authorizer");
         } else
           getErr()
               .println(
                   "Signature: "
                       + signature.getAuthorizer(getTransaction())
                       + " has no context authority (!?)");
       } else
         getErr()
             .println(
                 "Signature: "
                     + signature.getAuthorizer(getTransaction())
                     + " is for a root context");
     } else
       getErr().println("Signature: " + signature.getAuthorizer(getTransaction()) + " not valid");
   }
   return null;
 }