protected override ISignatureValueSecurityElement[] CreateSignatureConfirmationElements(SignatureConfirmations signatureConfirmations) { if ((signatureConfirmations == null) || (signatureConfirmations.Count == 0)) { return(null); } ISignatureValueSecurityElement[] elementArray = new ISignatureValueSecurityElement[signatureConfirmations.Count]; for (int i = 0; i < signatureConfirmations.Count; i++) { byte[] buffer; bool flag; signatureConfirmations.GetConfirmation(i, out buffer, out flag); elementArray[i] = new SignatureConfirmationElement(base.GenerateId(), buffer, base.StandardsManager.SecurityVersion); } return(elementArray); }
protected override ISignatureValueSecurityElement[] CreateSignatureConfirmationElements(SignatureConfirmations signatureConfirmations) { if (signatureConfirmations == null || signatureConfirmations.Count == 0) { return null; } ISignatureValueSecurityElement[] result = new ISignatureValueSecurityElement[signatureConfirmations.Count]; for (int i = 0; i < signatureConfirmations.Count; ++i) { byte[] sigValue; bool isEncrypted; signatureConfirmations.GetConfirmation(i, out sigValue, out isEncrypted); result[i] = new SignatureConfirmationElement(this.GenerateId(), sigValue, this.StandardsManager.SecurityVersion); } return result; }
protected override ISignatureValueSecurityElement[] CreateSignatureConfirmationElements(SignatureConfirmations signatureConfirmations) { if (signatureConfirmations == null || signatureConfirmations.Count == 0) { return(null); } ISignatureValueSecurityElement[] result = new ISignatureValueSecurityElement[signatureConfirmations.Count]; for (int i = 0; i < signatureConfirmations.Count; ++i) { byte[] sigValue; bool isEncrypted; signatureConfirmations.GetConfirmation(i, out sigValue, out isEncrypted); result[i] = new SignatureConfirmationElement(this.GenerateId(), sigValue, this.StandardsManager.SecurityVersion); } return(result); }
protected void CheckSignatureConfirmation(ReceiveSecurityHeader securityHeader, SecurityProtocolCorrelationState[] correlationStates) { SignatureConfirmations receivedConfirmations = securityHeader.GetSentSignatureConfirmations(); SignatureConfirmations sentSignatures = null; if (correlationStates != null) { for (int i = 0; i < correlationStates.Length; ++i) { if (correlationStates[i].SignatureConfirmations != null) { sentSignatures = correlationStates[i].SignatureConfirmations; break; } } } if (sentSignatures == null) { if (receivedConfirmations != null && receivedConfirmations.Count > 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.GetString(SR.FoundUnexpectedSignatureConfirmations))); } return; } bool allSignaturesConfirmed = false; if (receivedConfirmations != null && sentSignatures.Count == receivedConfirmations.Count) { bool[] matchingSigIndexes = new bool[sentSignatures.Count]; for (int i = 0; i < sentSignatures.Count; ++i) { byte[] sentSignature; bool wasSentSigEncrypted; sentSignatures.GetConfirmation(i, out sentSignature, out wasSentSigEncrypted); for (int j = 0; j < receivedConfirmations.Count; ++j) { byte[] receivedSignature; bool wasReceivedSigEncrypted; if (matchingSigIndexes[j]) { continue; } receivedConfirmations.GetConfirmation(j, out receivedSignature, out wasReceivedSigEncrypted); if ((wasReceivedSigEncrypted == wasSentSigEncrypted) && CryptoHelper.IsEqual(receivedSignature, sentSignature)) { matchingSigIndexes[j] = true; break; } } } int k; for (k = 0; k < matchingSigIndexes.Length; ++k) { if (!matchingSigIndexes[k]) { break; } } if (k == matchingSigIndexes.Length) { allSignaturesConfirmed = true; } } if (!allSignaturesConfirmed) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.GetString(SR.NotAllSignaturesConfirmed))); } }
protected void CheckSignatureConfirmation(ReceiveSecurityHeader securityHeader, SecurityProtocolCorrelationState[] correlationStates) { SignatureConfirmations sentSignatureConfirmations = securityHeader.GetSentSignatureConfirmations(); SignatureConfirmations signatureConfirmations = null; if (correlationStates != null) { for (int i = 0; i < correlationStates.Length; i++) { if (correlationStates[i].SignatureConfirmations != null) { signatureConfirmations = correlationStates[i].SignatureConfirmations; break; } } } if (signatureConfirmations == null) { if ((sentSignatureConfirmations != null) && (sentSignatureConfirmations.Count > 0)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(System.ServiceModel.SR.GetString("FoundUnexpectedSignatureConfirmations"))); } } else { bool flag = false; if ((sentSignatureConfirmations != null) && (signatureConfirmations.Count == sentSignatureConfirmations.Count)) { bool[] flagArray = new bool[signatureConfirmations.Count]; for (int j = 0; j < signatureConfirmations.Count; j++) { byte[] buffer; bool flag2; signatureConfirmations.GetConfirmation(j, out buffer, out flag2); for (int k = 0; k < sentSignatureConfirmations.Count; k++) { if (!flagArray[k]) { byte[] buffer2; bool flag3; sentSignatureConfirmations.GetConfirmation(k, out buffer2, out flag3); if ((flag3 == flag2) && CryptoHelper.IsEqual(buffer2, buffer)) { flagArray[k] = true; break; } } } } int index = 0; while (index < flagArray.Length) { if (!flagArray[index]) { break; } index++; } if (index == flagArray.Length) { flag = true; } } if (!flag) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(System.ServiceModel.SR.GetString("NotAllSignaturesConfirmed"))); } } }