How to access the HTTPS protocol in Linux

Source: Internet
Author: User

1. http://www.mono-project.com/FAQ:_Security

1,Inux itself does not carry any certificates when it is released, which seems to be the opposite of windows. However, there are tools that allow us to install certificates on our own.

 

Mozrots -- import/# import a certificate

 

-- Ask-Remove/# confirm the deletion only

 

-- Machine # Save it to the global environment

 

 
Mozrots -- import -- sync

Or manually add the certificate

 
Certmgr-SSL https://T.open.com

2.ProgramJoinCodeThe HTTPS protocol is correct by default.

 Using  System;  Using  System. Security. cryptography. x509certificates; Namespace  Ssltest {  Class  Mainclass {  //  Callback used to validate the Certificate in an SSL conversation          Private   Static   Bool  Validateremotecertificate (  Object  Sender, x509certificate certificate, x509chain chain, system. net. Security. sslpolicyerrors policyerrors ){ Return   True  ;  /*  If (convert. toboolean (configurationmanager. appsettings ["ignoresslerrors"]) {// allow any old dodgy certificate... return true;} else {return policyerrors = sslpolicyerrors. none ;}  */  }  //  End function validateremotecertificate                  Public   Static  Void Main ( String  [] ARGs ){  //  System. net. servicepointmanager. servercertificatevalidationcallback + = validateremotecertificate; System. net. servicepointmanager. servercertificatevalidationcallback + = (S, Ce, Ca, P) => True  ;  String Strresponse = Null  ;  Try {System. net. webrequest request = System. net. httpwebrequest. Create ( "  Https://encrypted.google.com/  "  ); System. net. httpwebresponse response = (System. net. httpwebresponse) request. getresponse (); system. Io. Stream stream = Response. getresponsestream (); system. Io. streamreader SR = New  System. Io. streamreader (Stream); strresponse =Sr. readtoend (); Sr. Close (); Sr. Dispose (); stream. Dispose ();}  Catch  (System. Io. ioexception ex) {console. writeline (  "  Failed to connect to Uri  "  ); Console. writeline (  "  Reason:  "  ); Console. writeline (ex. Message); console. writeline (environment. newline); console. writeline ( "  Stacktrace:  "  ); Console. writeline (ex. stacktrace );}  Catch  (System. uriformatexception ex) {console. writeline (  "  Bad URI format  "  ); Console. writeline (  "  Reason:  " ); Console. writeline (ex. Message); console. writeline (environment. newline); console. writeline (  "  Stacktrace:  "  ); Console. writeline (ex. stacktrace);} console. writeline (  "  Read the following stream:  "  ); Console. writeline (strresponse); console. writeline (environment. newline); console. writeline (  " --- Press any key to continue ---  "  ); Console. readkey ();}  //  End sub main  }  //  End Class mainclass  }  //  End namespace ssltest 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.