public ValidationRequest(Interest interest, OnVerified onVerified, OnVerifyFailed onVerifyFailed, int retry, int stepCount) { interest_ = interest; onVerified_ = onVerified; onVerifyFailed_ = onVerifyFailed; retry_ = retry; stepCount_ = stepCount; }
public VerifyCallbacks(KeyChain chain, ValidationRequest nextStep, int retry, OnVerifyFailed onVerifyFailed, Data originalData) { outer_KeyChain = chain; nextStep_ = nextStep; retry_ = retry; onVerifyFailed_ = onVerifyFailed; originalData_ = originalData; }
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); } } }
/// <summary> /// Check the signature on the Data object and call either onVerify.onVerify or /// onVerifyFailed.onVerifyFailed. /// We use callback functions because verify may fetch information to check the /// signature. /// </summary> /// /// <param name="data">To set the wireEncoding, you can call data.wireDecode.</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 verifyData(Data data, OnVerified onVerified, OnVerifyFailed onVerifyFailed) { verifyData(data, onVerified, onVerifyFailed, 0); }
/// <summary> /// Check the signature on the Data object and call either onVerify.onVerify or /// onVerifyFailed.onVerifyFailed. /// We use callback functions because verify may fetch information to check the /// signature. /// </summary> /// /// <param name="data">To set the wireEncoding, you can call data.wireDecode.</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 verifyData(Data data, OnVerified onVerified, OnVerifyFailed onVerifyFailed) { // Wrap the onVerifyFailed in an OnDataValidationFailed. verifyData(data, onVerified, new KeyChain.Anonymous_C1 (onVerifyFailed)); }
public Anonymous_C1(OnVerifyFailed onVerifyFailed_0) { this.onVerifyFailed = onVerifyFailed_0; }
/// <summary> /// Check whether the received data packet complies with the verification /// policy, and get the indication of the next verification step. /// </summary> /// /// <param name="data">The Data object 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(Data data, int stepCount, OnVerified onVerified, OnVerifyFailed onVerifyFailed);
/// <summary> /// Override to call onVerified.onVerified(data) and to indicate no further /// verification step. /// </summary> /// /// <param name="data">The Data object with the signature to check.</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(Data data, int stepCount, OnVerified onVerified, OnVerifyFailed onVerifyFailed) { try { onVerified.onVerified(data); } catch (Exception ex) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerified", ex); } return(null); }
/// <summary> /// Look in the IdentityStorage for the public key with the name in the /// KeyLocator (if available) and use it to verify the data packet. If the /// public key can't be found, call onVerifyFailed. /// </summary> /// /// <param name="data">The Data object with the signature to check.</param> /// <param name="stepCount"></param> /// <param name="onVerified">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(Data data, int stepCount, OnVerified onVerified, OnVerifyFailed onVerifyFailed) { // wireEncode returns the cached encoding if available. if (verify(data.getSignature(), data.wireEncode())) { try { onVerified.onVerified(data); } catch (Exception ex) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerified", ex); } } else { try { onVerifyFailed.onVerifyFailed(data); } catch (Exception ex_0) { logger_.log(ILOG.J2CsMapping.Util.Logging.Level.SEVERE, "Error in onVerifyFailed", ex_0); } } // No more steps, so return a null ValidationRequest. return(null); }