This is called by post_build() for key creation.
548248
def create_privkey(self):
        
        if self.group in _tls_named_ffdh_groups:
            params = _ffdh_groups[_tls_named_ffdh_groups[self.group]][0]
            privkey = params.generate_private_key()
            self.privkey = privkey
            pubkey = privkey.public_key()
            self.key_exchange = pubkey.public_numbers().y
        elif self.group in _tls_named_curves:
            if _tls_named_curves[self.group] == "x25519":
                if conf.crypto_valid_advanced:
                    privkey = x25519.X25519PrivateKey.generate()
                    self.privkey = privkey
                    pubkey = privkey.public_key()
                    self.key_exchange = pubkey.public_bytes()
            elif _tls_named_curves[self.group] != "x448":
                curve = ec._CURVE_TYPES[_tls_named_curves[self.group]]()
                privkey = ec.generate_private_key(curve, default_backend())
                self.privkey = privkey
                pubkey = privkey.public_key()
                try:
                    # cryptography >= 2.5
                    self.key_exchange = pubkey.public_bytes(
                        serialization.Encoding.X962,
                        serialization.PublicFormat.UncompressedPoint
                    )
                except TypeError:
                    # older versions
                    self.key_exchange = pubkey.public_numbers().encode_point()
648519
public function build()
    {

        $query_params = [];

        $query_params["query"] = $this->q;

        if($this->boost > 1) {
            $query_params["boost"] = $this->boost;
        }

        if(count($this->fields)){
            $query_params["fields"] = $this->fields;
        }

        $this->query->must[] = [
            "query_string" => $query_params
        ];
    }
1356009
public function onCommit()
    {
        if (!empty($this->keysToDelete)) {
            $this->keysToDelete = array_unique($this->keysToDelete);
            foreach ($this->keysToDelete as $key) {
                $this->delete($key);
            }
            $this->keysToDelete = array();
        }
    }
1316377
def do_build(self):
        
        tmp = self.explicit
        self.explicit = True
        b = super(KeyShareEntry, self).do_build()
        self.explicit = tmp
        return b
1349665
def do_build(self):
        
        if not self.explicit:
            self = next(iter(self))
        pkt = self.self_build()
        for t in self.post_transforms:
            pkt = t(pkt)
        pay = self.do_build_payload()
        if self.raw_packet_cache is None:
            return self.post_build(pkt, pay)
        else:
            return pkt + pay
1107138
def post_build(self, pkt, pay):
        
        # Compute the length of TLSPlaintext fragment
        hdr, frag = pkt[:5], pkt[5:]
        tmp_len = len(frag)
        hdr = hdr[:3] + struct.pack("!H", tmp_len)

        # Compression
        cfrag = self._tls_compress(frag)
        tmp_len = len(cfrag)  # Update the length as a result of compression
        hdr = hdr[:3] + struct.pack("!H", tmp_len)

        cipher_type = self.tls_session.wcs.cipher.type

        if cipher_type == 'block':
            # Integrity
            mfrag = self._tls_hmac_add(hdr, cfrag)

            # Excerpt below better corresponds to TLS 1.1 IV definition,
            # but the result is the same as with TLS 1.2 anyway.
            # if self.version >= 0x0302:
            #    l = self.tls_session.wcs.cipher.block_size
            #    iv = randstring(l)
            #    mfrag = iv + mfrag

            # Add padding
            pfrag = self._tls_pad(mfrag)

            # Encryption
            if self.version >= 0x0302:
                # Explicit IV for TLS 1.1 and 1.2
                tmp_len = self.tls_session.wcs.cipher.block_size
                iv = randstring(tmp_len)
                self.tls_session.wcs.cipher.iv = iv
                efrag = self._tls_encrypt(pfrag)
                efrag = iv + efrag
            else:
                # Implicit IV for SSLv3 and TLS 1.0
                efrag = self._tls_encrypt(pfrag)

        elif cipher_type == "stream":
            # Integrity
            mfrag = self._tls_hmac_add(hdr, cfrag)
            # Encryption
            efrag = self._tls_encrypt(mfrag)

        elif cipher_type == "aead":
            # Authenticated encryption (with nonce_explicit as header)
            efrag = self._tls_auth_encrypt(cfrag)

        if self.len is not None:
            # The user gave us a 'len', let's respect this ultimately
            hdr = hdr[:3] + struct.pack("!H", self.len)
        else:
            # Update header with the length of TLSCiphertext.fragment
            hdr = hdr[:3] + struct.pack("!H", len(efrag))

        # Now we commit the pending write state if it has been triggered (e.g.
        # by an underlying TLSChangeCipherSpec or a SSLv2ClientMasterKey). We
        # update nothing if the pwcs was not set. This probably means that
        # we're working out-of-context (and we need to keep the default wcs).
        if self.tls_session.triggered_pwcs_commit:
            if self.tls_session.pwcs is not None:
                self.tls_session.wcs = self.tls_session.pwcs
                self.tls_session.pwcs = None
            self.tls_session.triggered_pwcs_commit = False

        return hdr + efrag + pay
899008
private void addConstructorByKeyRef() {
    context.constructorByKeyRef = MethodSpec.constructorBuilder().addParameter(keyRefSpec);
    addCommonParameters(context.constructorByKeyRef);
    if (isBaseClass()) {
      assignKeyRefAndValue();
    } else {
      callParentByKeyRef();
    }
  }
1358306
private void createKeysIfNotExist() {
        if (!keyPairExists()) {
            try {
                final KeyPair keyPair = generateKeyPair();
                save(keyPair);
            } catch (NoSuchAlgorithmException e) {
                LOGGER.error("An error occurred generating new keypair");
                LOGGER.error(e.getMessage());
            } catch (IOException e) {
                LOGGER.error("An error occurred saving newly generated keypair");
                LOGGER.error(e.getMessage());
            }
        }
        if (!secretKeyExists()) {
            try {
                final SecretKey secretKey = generateSecretKey();
                save(secretKey);
            } catch (NoSuchAlgorithmException e) {
                LOGGER.error("An error occurred generating new secret key");
                LOGGER.error(e.getMessage());
            } catch (IOException e) {
                LOGGER.error("An error occurred saving newly generated secret key");
                LOGGER.error(e.getMessage());
            }
        }
    }
797688
def create(options)
      status, body = key_create(options)

      if status
        save_message('Key': ['created!'])
        true
      else
        save_message(body)
        false
      end
    end
790054
def post_public_key(self, path, data, is_json=True):
        ''''''
        post_data = {
            'public_key': self.public_key
        }
        post_data.update(data)
        return self._post(path, post_data, is_json)
94734
def create_key(self, title, key):
        
        assert isinstance(title, (str, unicode)), title
        assert isinstance(key, (str, unicode)), key
        post_parameters = {
            "title": title,
            "key": key,
        }
        headers, data = self._requester.requestJsonAndCheck(
            "POST",
            "/user/keys",
            input=post_parameters
        )
        return github.UserKey.UserKey(self._requester, headers, data, completed=True)
1043449
function init_sandbox( $secret_key ) {
            $this->_plugin->secret_key = $secret_key;

            // Update plugin details.
            FS_Plugin_Manager::instance( $this->_module_id )->update( $this->_plugin, true );
        }
1307004
@Override
	protected AbstractChainedResourceBundlePostProcessor buildProcessorByKey(String procesorKey) {
		if (PostProcessFactoryConstant.JSMIN.equals(procesorKey))
			return buildJSMinPostProcessor();
		else if (PostProcessFactoryConstant.LICENSE_INCLUDER.equals(procesorKey))
			return buildLicensesProcessor();
		else if (PostProcessFactoryConstant.UGLIFY_JS.equals(procesorKey))
			return buildUglifyJSProcessor();
		else if (PostProcessFactoryConstant.YUI_COMPRESSOR.equals(procesorKey))
			return new YUIJSCompressor(false);
		else if (PostProcessFactoryConstant.YUI_COMPRESSOR_OBFUSCATOR.equals(procesorKey))
			return new YUIJSCompressor(true);
		else
			throw new IllegalArgumentException("The supplied key [" + procesorKey
					+ "] is not bound to any ResourceBundlePostProcessor. Please check the documentation for valid keys. ");
	}
457820
def initialize_post(self):
        
        self.model = self.get_model()
        for key in self.model.keys():
            self.model.set(key, self.json_arguments.get(key))
1186735
function buildPostbid() {
  var fileContent = fs.readFileSync('./build/postbid/postbid-config.js', 'utf8');

  return gulp.src('./integrationExamples/postbid/oas/postbid.js')
    .pipe(replace('\[%%postbid%%\]', fileContent))
    .pipe(gulp.dest('build/postbid/'));
}
716079
function postSave($create = false)
    {
        if (! is_null($this->callbackURL) && strpos($this->callbackURL, '{secure_id}')) {
            $this->callbackURL = str_replace('{secure_id}', $this->secure_id, $this->callbackURL);
            $this->update();
        }
    }
1336114
protected function create_key() {
		if ( is_array( $this->data ) ) {
			$this->data[ $this->key ] = null;
		} elseif ( is_object( $this->data ) ) {
			$this->data->{$this->key} = null;
		} else {
			$type = gettype( $this->data );
			throw new UnexpectedValueException(
				"Cannot create key \"{$this->key}\" on data type {$type}"
			);
		}
	}