Retrieve information about the current cipher

        Return a triple consisting of cipher name, SSL protocol version defining
        its use, and the number of secret bits. Return None if handshaking
        has not been completed.
168977
def cipher(self):
        

        if not self._handshake_done:
            return

        current_cipher = SSL_get_current_cipher(self._ssl.value)
        cipher_name = SSL_CIPHER_get_name(current_cipher)
        cipher_version = SSL_CIPHER_get_version(current_cipher)
        cipher_bits = SSL_CIPHER_get_bits(current_cipher)
        return cipher_name, cipher_version, cipher_bits
751136
def cert_pair(self):
        
        if self._ssl_cert and self._ssl_private_key:
            return (self._ssl_cert, self._ssl_private_key)
        else:
            return None
680744
def get_default_ssl_version():
    
    if hasattr(ssl, 'PROTOCOL_TLSv1_2'):
        return ssl.PROTOCOL_TLSv1_2
    elif hasattr(ssl, 'PROTOCOL_TLSv1_1'):
        return ssl.PROTOCOL_TLSv1_1
    elif hasattr(ssl, 'PROTOCOL_TLSv1'):
        return ssl.PROTOCOL_TLSv1
    return None
1260552
public int getCertNum() {
        for (int i = this.certChain.length - 1; i >= 0; i--) {
            if (!this.certChain[i].getSubjectDN().equals(this.certChain[i].getIssuerDN())) {
                return i + 1;
            }
        }
        return this.certChain.length;
    }
1142009
public String[] getEnabledCipherSuites(SSLEngine sslEngine) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "getEnabledCipherSuites");
        }
        String ciphers[] = null;

        // First check the properties object for the ciphers.
        Object ciphersObject = this.myConfig.get(Constants.SSLPROP_ENABLED_CIPHERS);
        if (null == ciphersObject) {
            // Did not find the enabled ciphers. Need to determine them here.
            String securityLevel = this.myConfig.getProperty(Constants.SSLPROP_SECURITY_LEVEL);
            if (null == securityLevel) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Defaulting to HIGH security level");
                }
                securityLevel = Constants.SECURITY_LEVEL_HIGH;
            }
            // Found the security level.
            ciphers = Constants.adjustSupportedCiphersToSecurityLevel(
                                                                      sslEngine.getSupportedCipherSuites(), securityLevel);
        } else {
            // Found enabled cipher suites. Now we need to put them in the right kind of object.
            if (ciphersObject instanceof String) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "enabledCipherSuites is a String: " + ciphersObject);
                }
                // Quickly break the string up into an array based on space delimiters.
                ciphers = ((String) ciphersObject).split("\\s");
            } else if (ciphersObject instanceof String[]) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "enabledCipherSuites is a String array");
                }
                ciphers = (String[]) ciphersObject;
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Invalid object for enabledCipherSuites: " + ciphersObject);
                }
            }
        }
        // check for when we're returning 0 ciphers as the connection will not
        // work and will be throwing errors later on
        if (null == ciphers || 0 == ciphers.length) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Unable to find any enabled ciphers");
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "getEnabledCipherSuites");
        }
        return ciphers;
    }
1095134
def encryption_details(self):
        
        event_type = self.findtext("event_type")
        if event_type != "encryption":
            raise AttributeError(
                'PREMIS events of type "{}" have no encryption'
                " details".format(event_type)
            )
        parsed_encryption_event_detail = self.parsed_event_detail
        encryption_program = _get_event_detail_attr(
            "program", parsed_encryption_event_detail
        )
        encryption_program_version = _get_event_detail_attr(
            "version", parsed_encryption_event_detail
        )
        encryption_key = _get_event_detail_attr("key", parsed_encryption_event_detail)
        return encryption_program, encryption_program_version, encryption_key
695188
def get_secret(
        end_state: NettingChannelEndState,
        secrethash: SecretHash,
) -> Optional[Secret]:
    """"""
    partial_unlock_proof = end_state.secrethashes_to_unlockedlocks.get(secrethash)

    if partial_unlock_proof is None:
        partial_unlock_proof = end_state.secrethashes_to_onchain_unlockedlocks.get(secrethash)

    if partial_unlock_proof is not None:
        return partial_unlock_proof.secret

    return None
1030551
def get_public_key(self):
        
        res = self.get_public_key_info()
        if 'error' in res:
            raise ValueError(res['error'])

        if res['type'] != 'singlesig':
            raise ValueError(res['error'])

        return res['public_keys'][0]
1307518
@Override
  public int cipherBits()
  {
    if (! (_s instanceof SSLSocket))
      return super.cipherBits();
    
    SSLSocket sslSocket = (SSLSocket) _s;
    
    SSLSession sslSession = sslSocket.getSession();
    
    if (sslSession != null)
      return _sslKeySizes.get(sslSession.getCipherSuite());
    else
      return 0;
  }
1248988
def getCiphertextLen(self, ciphertext):
        

        plaintext_length = self.getPlaintextLen(ciphertext)
        ciphertext_length = plaintext_length + Encrypter._CTXT_EXPANSION
        return ciphertext_length
294513
def get_server_info(self):
        
        # NB: can't do it this way due to recursion
        # codec = self._get_codec(ttb_supported=False)
        codec = PbufCodec()
        msg = Msg(riak.pb.messages.MSG_CODE_GET_SERVER_INFO_REQ, None,
                  riak.pb.messages.MSG_CODE_GET_SERVER_INFO_RESP)
        resp_code, resp = self._request(msg, codec)
        return codec.decode_get_server_info(resp)
202324
public String getStrongestCipher() {
        final String cipher;
        if (cipherExists("AES") && caps.contains(Capability.AES)) {
            cipher = "AES";
        } else if (cipherExists("DESede")
                   && caps.contains(Capability.TRIPLE_DES)) {
            cipher = "DESede";
        } else {
            cipher = "DES";
        }

        return cipher;
    }
579654
def info():
    """"""
    try:
        platform_info = {
            'system': platform.system(),
            'release': platform.release(),
        }
    except IOError:
        platform_info = {
            'system': 'Unknown',
            'release': 'Unknown',
        }

    implementation_info = _implementation()
    urllib3_info = {'version': urllib3.__version__}
    chardet_info = {'version': chardet.__version__}

    pyopenssl_info = {
        'version': None,
        'openssl_version': '',
    }
    if OpenSSL:
        pyopenssl_info = {
            'version': OpenSSL.__version__,
            'openssl_version': '%x' % OpenSSL.SSL.OPENSSL_VERSION_NUMBER,
        }
    cryptography_info = {
        'version': getattr(cryptography, '__version__', ''),
    }
    idna_info = {
        'version': getattr(idna, '__version__', ''),
    }

    system_ssl = ssl.OPENSSL_VERSION_NUMBER
    system_ssl_info = {
        'version': '%x' % system_ssl if system_ssl is not None else ''
    }

    return {
        'platform': platform_info,
        'implementation': implementation_info,
        'system_ssl': system_ssl_info,
        'using_pyopenssl': pyopenssl is not None,
        'pyOpenSSL': pyopenssl_info,
        'urllib3': urllib3_info,
        'chardet': chardet_info,
        'cryptography': cryptography_info,
        'idna': idna_info,
        'requests': {
            'version': requests_version,
        },
    }
919319
def decrypt(self):
        
        if not self._crypter:
            return b''
        try:
            plaintext = self._crypter.decrypt(self._ciphertext, **self._decrypt_params)
            return plaintext
        except Exception as e:
            exc_info = sys.exc_info()
            six.reraise(
                ValueError('Invalid ciphertext "%s", error: %s' % (self._ciphertext, e)),
                None,
                exc_info[2]
            )
358552
def get_environ(self, sock):
        """"""
        cipher = sock.cipher()
        ssl_environ = {
            "wsgi.url_scheme": "https",
            "HTTPS": "on",
            'SSL_PROTOCOL': cipher[1],
            'SSL_CIPHER': cipher[0]
##            SSL_VERSION_INTERFACE 	string 	The mod_ssl program version
##            SSL_VERSION_LIBRARY 	string 	The OpenSSL program version
            }
        return ssl_environ
114001
def get(self):
        """"""

        # First retrieve all header bytes in order to extract
        # length of the message remainder.
        header = ''
        while len(header) < self.HEADER_LENGTH:
            chunk = self._sock.recv(self.HEADER_LENGTH - len(header))
            chunk = chunk.decode() if self._encode else chunk
            if chunk == '':
                return None
            header += chunk
        length = int(header)

        # Then retrieve the remainder of the message.
        message = ''
        while len(message) < length:
            chunk = self._sock.recv(length - len(message))
            chunk = chunk.decode() if self._encode else chunk
            if chunk == '':
                return None
            message += chunk
        return message
505244
def getinfo(self):
        
        try:
            old_getinfo = AuthServiceProxy(self.__service_url, 'getinfo', self.__timeout, self.__conn, True)
            res = old_getinfo()
            if 'error' not in res:
                # 0.13 and earlier
                return res

        except JSONRPCException:
            pass

        network_info = self.getnetworkinfo()
        blockchain_info = self.getblockchaininfo()
        try:
            wallet_info = self.getwalletinfo()
        except:
            wallet_info = {
                'walletversion': None,
                'balance': None,
                'keypoololdest': None,
                'keypoolsize': None,
                'paytxfee': None,
            }

        res = {
            'version': network_info['version'],
            'protocolversion': network_info['protocolversion'],
            'walletversion': wallet_info['walletversion'],
            'balance': wallet_info['balance'],
            'blocks': blockchain_info['blocks'],
            'timeoffset': network_info['timeoffset'],
            'connections': network_info['connections'],
            'proxy': network_info['networks'],
            'difficulty': blockchain_info['difficulty'],
            'testnet': blockchain_info['chain'] == 'testnet',
            'keypoololdest': wallet_info['keypoololdest'],
            'keypoolsize': wallet_info['keypoolsize'],
            'paytxfee': wallet_info['paytxfee'],
            'errors': network_info['warnings'],
        }
        
        for k in ['unlocked_until', 'relayfee', 'paytxfee']:
            if wallet_info.has_key(k):
                res[k] = wallet_info[k]

        return res