public ValidationRequest checkVerificationPolicy(Interest interest, int stepCount, OnVerifiedInterest onVerified, OnVerifyInterestFailed onVerifyFailed) { return(checkVerificationPolicy(interest, stepCount, onVerified, onVerifyFailed, net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat())); }
public VerifyCallbacksForVerifyInterest(KeyChain chain, ValidationRequest nextStep, int retry, OnVerifyInterestFailed onVerifyFailed, Interest originalInterest) { outer_KeyChain = chain; nextStep_ = nextStep; retry_ = retry; onVerifyFailed_ = onVerifyFailed; originalInterest_ = originalInterest; }
/// <summary> /// Override to call onVerified.onVerifiedInterest(interest) and to indicate no /// further verification step. /// </summary> /// /// <param name="interest">The interest with the signature (to ignore).</param> /// <param name="stepCount"></param> /// <param name="onVerified">better error handling the callback should catch and properly handle any exceptions.</param> /// <param name="onVerifyFailed">Override to ignore this.</param> /// <returns>null for no further step.</returns> public sealed override ValidationRequest checkVerificationPolicy(Interest interest, int stepCount, OnVerifiedInterest onVerified, OnVerifyInterestFailed onVerifyFailed, WireFormat wireFormat) { try { onVerified.onVerifiedInterest(interest); } catch (Exception ex) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifiedInterest", ex); } return(null); }
public void verifyInterest(Interest interest, OnVerifiedInterest onVerified, OnVerifyInterestFailed onVerifyFailed, int stepCount) { ILOG.J2CsMapping.Util.Logging.Logger.getLogger(this.GetType().FullName).log(ILOG.J2CsMapping.Util.Logging.Level.INFO, "Enter Verify"); if (policyManager_.requireVerify(interest)) { ValidationRequest nextStep = policyManager_ .checkVerificationPolicy(interest, stepCount, onVerified, onVerifyFailed); if (nextStep != null) { KeyChain.VerifyCallbacksForVerifyInterest callbacks = new KeyChain.VerifyCallbacksForVerifyInterest( this, nextStep, nextStep.retry_, onVerifyFailed, interest); try { face_.expressInterest(nextStep.interest_, callbacks, callbacks); } catch (IOException ex) { try { onVerifyFailed.onVerifyInterestFailed(interest); } catch (Exception exception) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifyInterestFailed", exception); } } } } else if (policyManager_.skipVerifyAndTrust(interest)) { try { onVerified.onVerifiedInterest(interest); } catch (Exception ex_0) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifiedInterest", ex_0); } } else { try { onVerifyFailed.onVerifyInterestFailed(interest); } catch (Exception ex_1) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifyInterestFailed", ex_1); } } }
/// <summary> /// Use wireFormat.decodeSignatureInfoAndValue to decode the last two name /// components of the signed interest. Look in the IdentityStorage for the /// public key with the name in the KeyLocator (if available) and use it to /// verify the interest. If the public key can't be found, call onVerifyFailed. /// </summary> /// /// <param name="interest">The interest with the signature to check.</param> /// <param name="stepCount"></param> /// <param name="onVerified">NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param> /// <param name="onVerifyFailed">NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param> /// <returns>null for no further step for looking up a certificate chain.</returns> public override ValidationRequest checkVerificationPolicy(Interest interest, int stepCount, OnVerifiedInterest onVerified, OnVerifyInterestFailed onVerifyFailed, WireFormat wireFormat) { // Decode the last two name components of the signed interest net.named_data.jndn.Signature signature; try { signature = wireFormat.decodeSignatureInfoAndValue(interest .getName().get(-2).getValue().buf(), interest.getName() .get(-1).getValue().buf()); } catch (EncodingException ex) { logger_.log( ILOG.J2CsMapping.Util.Logging.Level.INFO, "Cannot decode the signed interest SignatureInfo and value", ex); try { onVerifyFailed.onVerifyInterestFailed(interest); } catch (Exception exception) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifyInterestFailed", exception); } return(null); } // wireEncode returns the cached encoding if available. if (verify(signature, interest.wireEncode(wireFormat))) { try { onVerified.onVerifiedInterest(interest); } catch (Exception ex_0) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifiedInterest", ex_0); } } else { try { onVerifyFailed.onVerifyInterestFailed(interest); } catch (Exception ex_1) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifyInterestFailed", ex_1); } } // No more steps, so return a null ValidationRequest. return(null); }
/// <summary> /// Check the signature on the signed interest and call either /// onVerify.onVerifiedInterest or onVerifyFailed.onVerifyInterestFailed. We /// use callback functions because verify may fetch information to check the /// signature. /// </summary> /// /// <param name="interest">The interest with the signature to check.</param> /// <param name="onVerified">NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param> /// <param name="onVerifyFailed">NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param> public void verifyInterest(Interest interest, OnVerifiedInterest onVerified, OnVerifyInterestFailed onVerifyFailed) { verifyInterest(interest, onVerified, onVerifyFailed, 0); }
/// <summary> /// Check the signature on the signed interest and call either /// onVerify.onVerifiedInterest or onVerifyFailed.onVerifyInterestFailed. We /// use callback functions because verify may fetch information to check the /// signature. /// </summary> /// /// <param name="interest">The interest with the signature to check.</param> /// <param name="onVerified">NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param> /// <param name="onVerifyFailed">NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param> public void verifyInterest(Interest interest, OnVerifiedInterest onVerified, OnVerifyInterestFailed onVerifyFailed) { // Wrap the onVerifyFailed in an OnInterestValidationFailed. verifyInterest(interest, onVerified, new KeyChain.Anonymous_C0 (onVerifyFailed)); }
public Anonymous_C0(OnVerifyInterestFailed onVerifyFailed_0) { this.onVerifyFailed = onVerifyFailed_0; }
/// <summary> /// Check whether the received signed interest complies with the verification /// policy, and get the indication of the next verification step. /// </summary> /// /// <param name="interest">The interest with the signature to check.</param> /// <param name="stepCount"></param> /// <param name="onVerified">NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param> /// <param name="onVerifyFailed">NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions.</param> /// <returns>the indication of next verification step, null if there is no /// further step.</returns> public abstract ValidationRequest checkVerificationPolicy( Interest interest, int stepCount, OnVerifiedInterest onVerified, OnVerifyInterestFailed onVerifyFailed, WireFormat wireFormat);