Пример #1
0
 public void onTimeout(Interest interest)
 {
     if (retry_ > 0)
     {
         // Issue the same expressInterest as in verifyData except decrement
         //   retry.
         KeyChain.VerifyCallbacks callbacks = new KeyChain.VerifyCallbacks(outer_KeyChain, nextStep_,
                                                                           retry_ - 1, onVerifyFailed_, originalData_);
         try {
             outer_KeyChain.face_.expressInterest(interest, callbacks, callbacks);
         } catch (IOException ex) {
             try {
                 onVerifyFailed_.onVerifyFailed(originalData_);
             } catch (Exception exception) {
                 net.named_data.jndn.security.KeyChain.logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifyFailed",
                                                                   exception);
             }
         }
     }
     else
     {
         try {
             onVerifyFailed_.onVerifyFailed(originalData_);
         } catch (Exception ex_0) {
             net.named_data.jndn.security.KeyChain.logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifyFailed", ex_0);
         }
     }
 }
Пример #2
0
        public void verifyData(Data data, OnVerified onVerified,
                               OnVerifyFailed onVerifyFailed, int stepCount)
        {
            ILOG.J2CsMapping.Util.Logging.Logger.getLogger(this.GetType().FullName).log(ILOG.J2CsMapping.Util.Logging.Level.INFO,
                                                                                        "Enter Verify");

            if (policyManager_.requireVerify(data))
            {
                ValidationRequest nextStep = policyManager_
                                             .checkVerificationPolicy(data, stepCount, onVerified,
                                                                      onVerifyFailed);
                if (nextStep != null)
                {
                    KeyChain.VerifyCallbacks callbacks = new KeyChain.VerifyCallbacks(this, nextStep,
                                                                                      nextStep.retry_, onVerifyFailed, data);
                    try {
                        face_.expressInterest(nextStep.interest_, callbacks,
                                              callbacks);
                    } catch (IOException ex) {
                        try {
                            onVerifyFailed.onVerifyFailed(data);
                        } catch (Exception exception) {
                            logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifyFailed",
                                        exception);
                        }
                    }
                }
            }
            else if (policyManager_.skipVerifyAndTrust(data))
            {
                try {
                    onVerified.onVerified(data);
                } catch (Exception ex_0) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerified", ex_0);
                }
            }
            else
            {
                try {
                    onVerifyFailed.onVerifyFailed(data);
                } catch (Exception ex_1) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifyFailed", ex_1);
                }
            }
        }
Пример #3
0
        public void verifyData(Data data, OnVerified onVerified,
				OnDataValidationFailed onValidationFailed, int stepCount)
        {
            ILOG.J2CsMapping.Util.Logging.Logger.getLogger(this.GetType().FullName).log(ILOG.J2CsMapping.Util.Logging.Level.INFO,
                    "Enter Verify");

            if (policyManager_.requireVerify(data)) {
                ValidationRequest nextStep = policyManager_
                        .checkVerificationPolicy(data, stepCount, onVerified,
                                onValidationFailed);
                if (nextStep != null) {
                    KeyChain.VerifyCallbacks  callbacks = new KeyChain.VerifyCallbacks (this, nextStep,
                            nextStep.retry_, onValidationFailed, data);
                    try {
                        face_.expressInterest(nextStep.interest_, callbacks,
                                callbacks);
                    } catch (IOException ex) {
                        try {
                            onValidationFailed.onDataValidationFailed(data,
                                    "Error calling expressInterest " + ex);
                        } catch (Exception exception) {
                            logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                                    "Error in onDataValidationFailed", exception);
                        }
                    }
                }
            } else if (policyManager_.skipVerifyAndTrust(data)) {
                try {
                    onVerified.onVerified(data);
                } catch (Exception ex_0) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerified", ex_0);
                }
            } else {
                try {
                    onValidationFailed
                            .onDataValidationFailed(data,
                                    "The packet has no verify rule but skipVerifyAndTrust is false");
                } catch (Exception ex_1) {
                    logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onDataValidationFailed", ex_1);
                }
            }
        }
Пример #4
0
 public void onTimeout(Interest interest)
 {
     if (retry_ > 0) {
             // Issue the same expressInterest as in verifyData except decrement
             //   retry.
             KeyChain.VerifyCallbacks  callbacks = new KeyChain.VerifyCallbacks (outer_KeyChain, nextStep_,
                     retry_ - 1, onValidationFailed_, originalData_);
             try {
                 outer_KeyChain.face_.expressInterest(interest, callbacks, callbacks);
             } catch (IOException ex) {
                 try {
                     onValidationFailed_.onDataValidationFailed(
                             originalData_,
                             "Error in expressInterest to retry after timeout for fetching "
                                     + interest.getName().toUri() + ": "
                                     + ex);
                 } catch (Exception exception) {
                     net.named_data.jndn.security.KeyChain.logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                             "Error in onDataValidationFailed", exception);
                 }
             }
         } else {
             try {
                 onValidationFailed_.onDataValidationFailed(originalData_,
                         "The retry count is zero after timeout for fetching "
                                 + interest.getName().toUri());
             } catch (Exception ex_0) {
                 net.named_data.jndn.security.KeyChain.logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE,
                         "Error in onDataValidationFailed", ex_0);
             }
         }
 }