Commit bf55a4ad bf55a4addff775f64ac40c740b746171a6589d4a by Christian Gerdes

Fixed a bug when parsing PEM files in Client Certificate plugin

1 parent 75ee06ae
...@@ -784,9 +784,8 @@ namespace LIL_VSTT_Plugins ...@@ -784,9 +784,8 @@ namespace LIL_VSTT_Plugins
784 Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair bcKey = null; 784 Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair bcKey = null;
785 Org.BouncyCastle.X509.X509Certificate bcCert = null; 785 Org.BouncyCastle.X509.X509Certificate bcCert = null;
786 786
787 while (keyTextBeginPos != -1) 787 while (keyTextBeginPos != -1 && keyTextEndPos != -1)
788 { 788 {
789 text = text.Substring(keyTextBeginPos);
790 object obj; 789 object obj;
791 try 790 try
792 { 791 {
...@@ -818,6 +817,8 @@ namespace LIL_VSTT_Plugins ...@@ -818,6 +817,8 @@ namespace LIL_VSTT_Plugins
818 } 817 }
819 } 818 }
820 keyTextBeginPos = text.IndexOf("-----BEGIN", keyTextEndPos); 819 keyTextBeginPos = text.IndexOf("-----BEGIN", keyTextEndPos);
820 if(keyTextBeginPos >= 0) text = text.Substring(keyTextBeginPos);
821 keyTextEndPos = text.IndexOf("-----END");
821 } 822 }
822 if (bcCert == null) 823 if (bcCert == null)
823 { 824 {
......
...@@ -86,6 +86,9 @@ ...@@ -86,6 +86,9 @@
86 <None Include="LoadTest4.loadtest"> 86 <None Include="LoadTest4.loadtest">
87 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 87 <CopyToOutputDirectory>Always</CopyToOutputDirectory>
88 </None> 88 </None>
89 <None Include="WebTest2.webtest">
90 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
91 </None>
89 <None Include="WebTest22.webtest"> 92 <None Include="WebTest22.webtest">
90 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 93 <CopyToOutputDirectory>Always</CopyToOutputDirectory>
91 </None> 94 </None>
......
1 <?xml version="1.0" encoding="utf-8"?>
2 <WebTest Name="WebTest2" Id="97416298-3dc2-4f16-a28f-75470ee03ec8" Owner="" Priority="2147483647" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="0" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale="">
3 <Items>
4 <Request Method="GET" Guid="b9a8ca3a-ceb3-4531-b567-9ee2dbd79c10" Version="1.1" Url="https://ort-api-20.test.minpension.se/medborgare/197503140555" ThinkTime="0" Timeout="300" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" />
5 </Items>
6 <WebTestPlugins>
7 <WebTestPlugin Classname="LIL_VSTT_Plugins.ClientCertificatePlugin, LIL_VSTT_Plugins, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Client Certificate" Description="(C) Copyright 2016 LIGHTS IN LINE AB&#xD;&#xA;Sätter webtestet att använda ett specifikt client cert för SSL. Certifikatet installeras automatiskt i Windows User Certificate Store.">
8 <RuleParameters>
9 <RuleParameter Name="pCertificatePath" Value="C:\Temp\lightsinline_cert_key.pem" />
10 <RuleParameter Name="pCertificatePathParameter" Value="" />
11 <RuleParameter Name="pCertificatePassword" Value="" />
12 <RuleParameter Name="pCertificatePasswordParameter" Value="" />
13 <RuleParameter Name="pDebug" Value="False" />
14 <RuleParameter Name="pInstallTrusted" Value="True" />
15 <RuleParameter Name="pInstallUntrusted" Value="True" />
16 </RuleParameters>
17 </WebTestPlugin>
18 </WebTestPlugins>
19 </WebTest>
...\ No newline at end of file ...\ No newline at end of file