File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,9 @@ public X509Certificate2 X509Certificate2
117117 {
118118 get
119119 {
120- if ( _certificado != null )
121- if ( ! ConfiguracaoCertificado . ManterDadosEmCache )
122- _certificado . Reset ( ) ;
120+ if ( _certificado != null && ! DeveManterCertificadoEmCache ( ) )
121+ _certificado . Reset ( ) ;
122+
123123 _certificado = ObterCertificado ( ) ;
124124 return _certificado ;
125125 }
@@ -190,14 +190,20 @@ public void Dispose()
190190
191191 private void LimparCertificado ( )
192192 {
193- var naoDeveManterCertificadoEmCache =
194- ! ConfiguracaoCertificado . ManterDadosEmCache && _certificado != null ;
193+ if ( DeveManterCertificadoEmCache ( ) )
194+ return ;
195195
196- if ( naoDeveManterCertificadoEmCache )
197- {
198- _certificado . Reset ( ) ;
199- _certificado = null ;
200- }
196+ _certificado . Reset ( ) ;
197+ _certificado = null ;
198+ }
199+
200+ private bool DeveManterCertificadoEmCache ( )
201+ {
202+ var deveManterCertificadoEmCache = _certificado == null ||
203+ ConfiguracaoCertificado == null ||
204+ ConfiguracaoCertificado . ManterDadosEmCache ;
205+
206+ return deveManterCertificadoEmCache ;
201207 }
202208 }
203209}
You can’t perform that action at this time.
0 commit comments