Return the 3-tuple made of the Key Exchange Algorithm class, the Cipher
    class and the HMAC class, through the parsing of the ciphersuite name.
540307
def get_algs_from_ciphersuite_name(ciphersuite_name):
    
    tls1_3 = False
    if ciphersuite_name.startswith("TLS"):
        s = ciphersuite_name[4:]

        if s.endswith("CCM") or s.endswith("CCM_8"):
            kx_name, s = s.split("_WITH_")
            kx_alg = _tls_kx_algs.get(kx_name)
            hash_alg = _tls_hash_algs.get("SHA256")
            cipher_alg = _tls_cipher_algs.get(s)
            hmac_alg = None

        else:
            if "WITH" in s:
                kx_name, s = s.split("_WITH_")
                kx_alg = _tls_kx_algs.get(kx_name)
            else:
                tls1_3 = True
                kx_alg = _tls_kx_algs.get("TLS13")

            hash_name = s.split('_')[-1]
            hash_alg = _tls_hash_algs.get(hash_name)

            cipher_name = s[:-(len(hash_name) + 1)]
            if tls1_3:
                cipher_name += "_TLS13"
            cipher_alg = _tls_cipher_algs.get(cipher_name)

            hmac_alg = None
            if cipher_alg is not None and cipher_alg.type != "aead":
                hmac_name = "HMAC-%s" % hash_name
                hmac_alg = _tls_hmac_algs.get(hmac_name)

    elif ciphersuite_name.startswith("SSL"):
        s = ciphersuite_name[7:]
        kx_alg = _tls_kx_algs.get("SSLv2")
        cipher_name, hash_name = s.split("_WITH_")
        cipher_alg = _tls_cipher_algs.get(cipher_name.rstrip("_EXPORT40"))
        kx_alg.export = cipher_name.endswith("_EXPORT40")
        hmac_alg = _tls_hmac_algs.get("HMAC-NULL")
        hash_alg = _tls_hash_algs.get(hash_name)

    return kx_alg, cipher_alg, hmac_alg, hash_alg, tls1_3
1188675
def get_hmac(message):
    
    key = current_app.config['WEBHOOKS_SECRET_KEY']
    hmac_value = hmac.new(
        key.encode('utf-8') if hasattr(key, 'encode') else key,
        message.encode('utf-8') if hasattr(message, 'encode') else message,
        sha1
    ).hexdigest()
    return hmac_value
461511
def get_cipher(self):
        
        return self.cipher_class.new(self.cipher_key, self.cipher_class.MODE_CBC, b'\0' * self.cipher_class.block_size)
1183318
def hmac(key, message, tag=None, alg=hashlib.sha256):
    
    return HMAC.new(str(key), str(tag) + str(message), digestmod=alg).digest()
1049047
def key_for_class
      word = self.class.name.split("::").last.to_s.dup
      word.gsub!(/::/, '/')
      word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
      word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
      word.tr!("-", "_")
      word.downcase!
      word.to_sym
    end
9936
public com.google.privacy.dlp.v2.KmsWrappedCryptoKeyOrBuilder getKmsWrappedOrBuilder() {
    if (sourceCase_ == 3) {
      return (com.google.privacy.dlp.v2.KmsWrappedCryptoKey) source_;
    }
    return com.google.privacy.dlp.v2.KmsWrappedCryptoKey.getDefaultInstance();
  }
931241
private void chooseCipherSuite(ClientHello mesg) throws IOException {
        for (CipherSuite suite : mesg.getCipherSuites().collection()) {
            if (isNegotiable(suite) == false) {
                continue;
            }

            if (doClientAuth == SSLEngineImpl.clauth_required) {
                if ((suite.keyExchange == K_DH_ANON) ||
                    (suite.keyExchange == K_ECDH_ANON)) {
                    continue;
                }
            }
            if (trySetCipherSuite(suite) == false) {
                continue;
            }
            return;
        }
        fatalSE(Alerts.alert_handshake_failure,
                    "no cipher suites in common");
    }
130420
private static Object createKeyPair() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException {
        Class keyGenClass = lookupKeyGenClass();
        Object keypair = ClassUtil.newInstance(keyGenClass, "RSA", "SHA1WithRSA");
        ClassUtil.applyMethod(keypair, "generate", 2048);
        return keypair;
    }
324923
def encrypt_cipher(triple_des_key)
      triple_des_key_urlencoded = ''

      key = OpenSSL::PKey::RSA.new(PUBLIC_KEY)
      encrypted_triple_des = key.public_encrypt(triple_des_key)
      encrypted_base64 = Base64.strict_encode64(encrypted_triple_des)
      triple_des_key_urlencoded = "#{CGI::escape(encrypted_base64)}decode"

      return triple_des_key_urlencoded
    end
154363
def encryption_mode(self):
        

        encryption_algo = self['algorithm'].native

        if encryption_algo[0:7] in set(['aes128_', 'aes192_', 'aes256_']):
            return encryption_algo[7:]

        if encryption_algo[0:6] == 'pbes1_':
            return 'cbc'

        if encryption_algo[0:7] == 'pkcs12_':
            return 'cbc'

        if encryption_algo in set(['des', 'tripledes_3key', 'rc2', 'rc5']):
            return 'cbc'

        if encryption_algo == 'pbes2':
            return self['parameters']['encryption_scheme'].encryption_mode

        raise ValueError(unwrap(
            '''
            Unrecognized encryption algorithm "%s"
            ''',
            encryption_algo
        ))
24835
def use(self,classtype,key):
		

		if type(key)==type([]):
			key=tuple(key)
		if (not key in self.dict[classtype]):
			if classtype in ['Phoneme','Onset','Nucleus','Coda','Rime','Syllable']:
				self.dict[classtype][key]=get_class(classtype+'.'+classtype)(key,self.lang)
				#return get_class(classtype+'.'+classtype)(key,self.lang)
			elif classtype=="SyllableBody":
				#self.dict[classtype][key]=self.syllphon2syll(key,self.lang)
				return self.syllphon2syll(key,self.lang)

		return self.dict[classtype][key]
850423
def get_cipher(key=None, keyfile=None):
    
    des_func = import_attr(settings.SECRETKEY.CIPHER_CLS)
    kwargs = settings.SECRETKEY.CIPHER_ARGS
    
    if not key:
        key = functions.get_cipher_key(keyfile)
    cipher = des_func(key, **kwargs)
    return cipher
517095
def get_algorithm(algorithm):
    

    global _hashes
    if _hashes is None:
        _setup_hashes()

    if isinstance(algorithm, (str, unicode)):
        algorithm = dns.name.from_text(algorithm)

    if sys.hexversion < 0x02050200 and \
       (algorithm == HMAC_SHA384 or algorithm == HMAC_SHA512):
        raise NotImplementedError("TSIG algorithm " + str(algorithm) +
                                  " requires Python 2.5.2 or later")

    try:
        return (algorithm.to_digestable(), _hashes[algorithm])
    except KeyError:
        raise NotImplementedError("TSIG algorithm " + str(algorithm) +
                                  " is not supported")
362367
def unwrap(self):
        

        if self.algorithm == 'rsa':
            return self['public_key'].parsed

        key_type = self.algorithm.upper()
        a_an = 'an' if key_type == 'EC' else 'a'
        raise ValueError(unwrap(
            '''
            Only RSA public keys may be unwrapped - this key is %s %s public
            key
            ''',
            a_an,
            key_type
        ))
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;
    }
880109
async def get_encryption_aes_key(self) -> Tuple[bytes, Dict[str, str], str]:
        

        random_bytes = os.urandom(32)

        padder = PKCS7(AES.block_size).padder()
        padded_result = await self._loop.run_in_executor(
            None, lambda: (padder.update(random_bytes) + padder.finalize()))

        aesecb = self._cipher.encryptor()
        encrypted_result = await self._loop.run_in_executor(
            None, lambda: (aesecb.update(padded_result) + aesecb.finalize()))

        return random_bytes, {}, base64.b64encode(encrypted_result).decode()
486270
def vocab_encryption_algo(instance):
    
    for key, obj in instance['objects'].items():
        if 'type' in obj and obj['type'] == 'file':
            try:
                enc_algo = obj['encryption_algorithm']
            except KeyError:
                continue
            if enc_algo not in enums.ENCRYPTION_ALGO_OV:
                yield JSONError("Object '%s' has an 'encryption_algorithm' of "
                                "'%s', which is not a value in the "
                                "encryption-algo-ov vocabulary."
                                % (key, enc_algo), instance['id'],
                                'encryption-algo')