/// <summary> /// Create a signed trust bundle. /// </summary> /// <param name="bundleResources">Provide a <see cref="IResourceProvider"/> to load anchors and storage destination.</param> /// <param name="signProvider">Provide a <see cref="ISignProvider"/> to sign the trust bundle</param> public byte[] Create(IResourceProvider bundleResources, ISignProvider signProvider) { byte[] p7Bdata = Create(bundleResources); byte[] p7MData = signProvider.Sign(p7Bdata); return p7MData; }
/// <summary> /// Create a signed trust bundle. /// </summary> /// <param name="bundleResources">Provide a <see cref="IResourceProvider"/> to load anchors and storage destination.</param> /// <param name="signProvider">Provide a <see cref="ISignProvider"/> to sign the trust bundle</param> public byte[] Create(IResourceProvider bundleResources, ISignProvider signProvider) { byte[] p7Bdata = Create(bundleResources); byte[] p7MData = signProvider.Sign(p7Bdata); return(p7MData); }
private Mock <Func <string, ISignProvider> > CreateMockSignProviderFactory(ISignProvider signProvider) { var providerFactory = new Mock <Func <string, ISignProvider> >(); providerFactory.Setup(x => x(It.IsAny <string>())).Returns(signProvider); return(providerFactory); }
private static void SetSignProvider(OAuthRequestContext context) { ISignProvider signingProvider = SignProviders.GetProvider(context.Parameters.SignatureMethod); if (signingProvider == null) { // There is no signing provider for this signature method throw new OAuthRequestException(null, OAuthProblemTypes.SignatureMethodRejected); } // Double check the signing provider declares that it can handle the signature method if (!signingProvider.SignatureMethod.Equals(context.Parameters.SignatureMethod)) { throw new OAuthRequestException(null, OAuthProblemTypes.SignatureMethodRejected); } context.SignProvider = signingProvider; }
private void SignParameters(Uri requestUri, string httpMethod, OAuthParameters authParameters, IToken token) { // Check there is a signing provider for the signature method ISignProvider signingProvider = context.GetSignProvider(Service.SignatureMethod); if (signingProvider == null) { // There is no signing provider for this signature method throw new OAuthRequestException(null, OAuthProblemTypes.SignatureMethodRejected); } // Double check the signing provider declares that it can handle the signature method if (!signingProvider.SignatureMethod.Equals(Service.SignatureMethod)) { throw new OAuthRequestException(null, OAuthProblemTypes.SignatureMethodRejected); } // Compute the signature authParameters.Sign(requestUri, httpMethod, Service.Consumer, token, signingProvider); }
public Url(string cloudName, ISignProvider signProvider) : this(cloudName) { m_signProvider = signProvider; }
/// <summary> /// Create a signed trust bundle. /// </summary> /// <param name="p7Bdata">Cms data structure</param> /// <param name="signProvider">Provide a <see cref="ISignProvider"/> to sign the trust bundle</param> public byte[] Sign(byte[] p7Bdata, ISignProvider signProvider) { byte[] p7MData = signProvider.Sign(p7Bdata); return(p7MData); }
public void Sign(Uri requestUri, string httpMethod, IConsumer consumer, IToken token, ISignProvider signingProvider) { if (token != null) { Token = token.Token; } OAuthParameters signingParameters = Clone(); var signingUri = new UriBuilder(requestUri); // Normalize the request uri for signing if (!string.IsNullOrEmpty(requestUri.Query)) { // TODO: Will the parameters necessarily be Rfc3698 encoded here? If not, then Rfc3968.SplitAndDecode will throw FormatException signingParameters.AdditionalParameters.Add(Rfc3986.SplitAndDecode(requestUri.Query.Substring(1))); signingUri.Query = null; } if (signingProvider == null) { // There is no signing provider for this signature method throw new OAuthRequestException(null, OAuthProblemTypes.SignatureMethodRejected); } // Compute the signature Signature = signingProvider.ComputeSignature( Security.Signature.Create(httpMethod, signingUri.Uri, signingParameters), consumer.Secret, (token != null && token.Secret != null) ? token.Secret : null); }
/// <summary> /// Create a signed trust bundle. /// </summary> /// <param name="p7Bdata">Cms data structure</param> /// <param name="signProvider">Provide a <see cref="ISignProvider"/> to sign the trust bundle</param> public byte[] Sign(byte[] p7Bdata, ISignProvider signProvider) { byte[] p7MData = signProvider.Sign(p7Bdata); return p7MData; }
public void Sign(Uri requestUri, string httpMethod, IConsumer consumer, IToken token, ISignProvider signingProvider) { if (token != null) Token = token.Token; OAuthParameters signingParameters = Clone(); var signingUri = new UriBuilder(requestUri); // Normalize the request uri for signing if (!string.IsNullOrEmpty(requestUri.Query)) { // TODO: Will the parameters necessarily be Rfc3698 encoded here? If not, then Rfc3968.SplitAndDecode will throw FormatException signingParameters.AdditionalParameters.Add(Rfc3986.SplitAndDecode(requestUri.Query.Substring(1))); signingUri.Query = null; } if (signingProvider == null) // There is no signing provider for this signature method throw new OAuthRequestException(null, OAuthProblemTypes.SignatureMethodRejected); // Compute the signature Signature = signingProvider.ComputeSignature( Security.Signature.Create(httpMethod, signingUri.Uri, signingParameters), consumer.Secret, (token != null && token.Secret != null) ? token.Secret : null); }