Exemplo n.º 1
0
 def test_txt2obj(self):
     import _ssl
     assert _ssl.txt2obj('serverAuth', name=True) == (
         129, 'serverAuth', 'TLS Web Server Authentication',
         '1.3.6.1.5.5.7.3.1')
     raises(ValueError, _ssl.txt2obj, 'serverAuth', name=False)
     assert _ssl.txt2obj('1.3.6.1.5.5.7.3.1', name=True) == (
         129, 'serverAuth', 'TLS Web Server Authentication',
         '1.3.6.1.5.5.7.3.1')
Exemplo n.º 2
0
 def test_txt2obj(self):
     import _ssl
     assert _ssl.txt2obj('serverAuth',
                         name=True) == (129, 'serverAuth',
                                        'TLS Web Server Authentication',
                                        '1.3.6.1.5.5.7.3.1')
     raises(ValueError, _ssl.txt2obj, 'serverAuth', name=False)
     assert _ssl.txt2obj('1.3.6.1.5.5.7.3.1',
                         name=True) == (129, 'serverAuth',
                                        'TLS Web Server Authentication',
                                        '1.3.6.1.5.5.7.3.1')
Exemplo n.º 3
0
def rdn_shortname(key):
    try:
        short = _ssl.txt2obj(key, True)[1]
    except (ValueError, KeyError):
        return key
    if short:
        return short
    else:
        return key