зеркало из https://github.com/microsoft/moc.git
updating proxy cert validation
This commit is contained in:
Родитель
82d2ddcdcc
Коммит
be6f8215e5
|
@ -48,8 +48,8 @@ func ValidateProxyURL(proxyURL string) error {
|
|||
|
||||
func ValidateCertFormatIsBase64(certContent string) error {
|
||||
|
||||
certContent = strings.Replace(certContent, "-----BEGIN CERTIFICATE-----\\n", "", -1)
|
||||
certContent = strings.Replace(certContent, "\\n-----END CERTIFICATE-----", "", -1)
|
||||
certContent = strings.Replace(certContent, "-----BEGIN CERTIFICATE-----", "", -1)
|
||||
certContent = strings.Replace(certContent, "-----END CERTIFICATE-----", "", -1)
|
||||
_, err := base64.StdEncoding.DecodeString(certContent)
|
||||
if err != nil {
|
||||
return errors.Wrapf(errors.InvalidInput, err.Error())
|
||||
|
|
|
@ -27,7 +27,7 @@ func Test_ValidateProxyURL(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_ValidateCertFormatIsBase64(t *testing.T) {
|
||||
certContent := "-----BEGIN CERTIFICATE-----\\nMIIDETCCAfkCFAjEhG/xypxPKN1URzLmLISCPuTVMA0GCSqGSIb3DQEBCwUAMEUx\\n-----END CERTIFICATE-----"
|
||||
certContent := "-----BEGIN CERTIFICATE-----MIIDETCCAfkCFAjEhG/xypxPKN1URzLmLISCPuTVMA0GCSqGSIb3DQEBCwUAMEUx-----END CERTIFICATE-----"
|
||||
err := ValidateCertFormatIsBase64(certContent)
|
||||
if err != nil {
|
||||
t.Fatalf("Test_ValidateCertFormat test case failed - Certificate content is not base64 encoded")
|
||||
|
|
Загрузка…
Ссылка в новой задаче