Beispiel #1
0
// NewCtxWithVersion creates an SSL context that is specific to the provided
// SSL version. See http://www.openssl.org/docs/ssl/SSL_CTX_new.html for more.
func NewCtxWithVersion(version SSLVersion) (*Ctx, error) {
	var method *C.SSL_METHOD
	switch version {
	case TLSv1:
		method = C.TLSv1_method()
	case AnyVersion:
		method = C.SSLv23_method()
	}
	if method == nil {
		return nil, errors.New("unknown ssl/tls version")
	}
	return newCtx(method)
}
Beispiel #2
0
// SSLv3 with fallback to v
func SSLv23Method() *METHOD {
	return &METHOD{C.SSLv23_method()}
}