Sign the transaction using the given passphrase.

@param string $passphrase

@return \ArkEcosystem\Crypto\Transactions\Builder\AbstractTransaction
333629
public function sign(string $passphrase): AbstractTransaction
    {
        $this->transaction->recipientId = Address::fromPassphrase($passphrase, Network::get());

        parent::sign($passphrase);

        return $this;
    }
531815
public function setSignature($algorithm)
    {
        /*
         * If we don't support passed algprithm, leave old one.
         */
        switch ($algorithm) {
            case 'md5':
                $this->signatureAlgorithm = Phar::MD5;
                break;
            case 'sha1':
                $this->signatureAlgorithm = Phar::SHA1;
                break;
            case 'sha256':
                $this->signatureAlgorithm = Phar::SHA256;
                break;
            case 'sha512':
                $this->signatureAlgorithm = Phar::SHA512;
                break;
            case 'openssl':
                $this->signatureAlgorithm = Phar::OPENSSL;
                break;
            default:
                break;
        }
    }
546841
def passphrase_file(passphrase=None):
    """"""
    cmd = []
    pass_file = None
    if not passphrase and 'CRYPTORITO_PASSPHRASE_FILE' in os.environ:
        pass_file = os.environ['CRYPTORITO_PASSPHRASE_FILE']
        if not os.path.isfile(pass_file):
            raise CryptoritoError('CRYPTORITO_PASSPHRASE_FILE is invalid')
    elif passphrase:
        tmpdir = ensure_tmpdir()
        pass_file = "%s/p_pass" % tmpdir
        p_handle = open(pass_file, 'w')
        p_handle.write(passphrase)
        p_handle.close()

    if pass_file:
        cmd = cmd + ["--batch", "--passphrase-file", pass_file]

        vsn = gpg_version()
        if vsn[0] >= 2 and vsn[1] >= 1:
            cmd = cmd + ["--pinentry-mode", "loopback"]

    return cmd
525092
public function setReasonPhrase($reasonPhrase)
    {
        if (is_string($reasonPhrase)) {
            $this->reasonPhrase = $reasonPhrase;
        } else {
            throw new HTTPException(
                sprintf('Reason phrase must be a string; %s provided', gettype($reasonPhrase))
            );
        }

        return $this;
    }
1010377
public function sign($key, $password = null)
    {
        OpenSslException::reset();

        if (false === extension_loaded('openssl')) {
            // @codeCoverageIgnoreStart
            throw OpenSslException::create(
                'The "openssl" extension is not available.'
            );
            // @codeCoverageIgnoreEnd
        }

        if (false === ($resource = openssl_pkey_get_private($key, $password))) {
            // @codeCoverageIgnoreStart
            throw OpenSslException::lastError();
            // @codeCoverageIgnoreEnd
        }

        if (false === openssl_pkey_export($resource, $private)) {
            // @codeCoverageIgnoreStart
            throw OpenSslException::lastError();
            // @codeCoverageIgnoreEnd
        }

        if (false === ($details = openssl_pkey_get_details($resource))) {
            // @codeCoverageIgnoreStart
            throw OpenSslException::lastError();
            // @codeCoverageIgnoreEnd
        }

        $this->phar->setSignatureAlgorithm(Phar::OPENSSL, $private);

        if (false === @file_put_contents($this->file . '.pubkey', $details['key'])) {
            throw FileException::lastError();
        }
    }
399842
public function sign($args) {
        if (empty($this->key)) {
            throw new Exception('KEY IS NEED');
        }
        ksort($args);
        reset($args);
        $arg = '';
        foreach ($args as $key => $item) {
            if (Http::isEmpty($item) ||
                in_array($key, $this->ignoreKeys)) {
                continue;
            }
            $arg .= "{$key}={$item}&";
        }
        $signContent = $arg.'key='.$this->key;
        if (!isset($args['sign_type']) || $args['sign_type'] == 'MD5') {
            return strtoupper(md5($signContent));
        }
        return strtoupper(hash_hmac('sha256', $signContent, $this->key, false));
    }
1089010
public function clientSideCert($cert, $key, $passphrase = null, $encoding = 'PEM')
    {
        $this->client_cert          = $cert;
        $this->client_key           = $key;
        $this->client_passphrase    = $passphrase;
        $this->client_encoding      = $encoding;

        return $this;
    }
158586
public function generateSignature($content, VirgilPrivateKey $signerPrivateKey)
    {
        try {
            return $this->cryptoService->sign($content, $signerPrivateKey->getValue());
        } catch (Exception $exception) {
            throw new VirgilCryptoException($exception->getMessage());
        }
    }
465835
public void changePassphrase(String oldpassphrase, String newpassphrase)
			throws IOException, InvalidPassphraseException {
		SshKeyPair pair = toKeyPair(oldpassphrase);
		formattedkey = encryptKey(pair, newpassphrase);
	}
160915
public static function changePassword($user = null, $password)
	{
		$passhash = self::getPasshash($password);

		return self::changePasshash($user, $passhash);
	}
680808
def sign_transaction(self, txins: Union[TxOut],
                         tx: MutableTransaction) -> MutableTransaction:
        ''''''

        solver = P2pkhSolver(self._private_key)
        return tx.spend(txins, [solver for i in txins])
972244
def ExportNEP2(self, passphrase):
        
        if len(passphrase) < 2:
            raise ValueError("Passphrase must have a minimum of 2 characters")

        # Hash address twice, then only use the first 4 bytes
        address_hash_tmp = hashlib.sha256(self.GetAddress().encode("utf-8")).digest()
        address_hash_tmp2 = hashlib.sha256(address_hash_tmp).digest()
        address_hash = address_hash_tmp2[:4]

        # Normalize password and run scrypt over it with the address_hash
        pwd_normalized = bytes(unicodedata.normalize('NFC', passphrase), 'utf-8')
        derived = scrypt.hash(pwd_normalized, address_hash,
                              N=SCRYPT_ITERATIONS,
                              r=SCRYPT_BLOCKSIZE,
                              p=SCRYPT_PARALLEL_FACTOR,
                              buflen=SCRYPT_KEY_LEN_BYTES)

        # Split the scrypt-result into two parts
        derived1 = derived[:32]
        derived2 = derived[32:]

        # Run XOR and encrypt the derived parts with AES
        xor_ed = xor_bytes(bytes(self.PrivateKey), derived1)
        cipher = AES.new(derived2, AES.MODE_ECB)
        encrypted = cipher.encrypt(xor_ed)

        # Assemble the final result
        assembled = bytearray()
        assembled.extend(NEP_HEADER)
        assembled.extend(NEP_FLAG)
        assembled.extend(address_hash)
        assembled.extend(encrypted)

        # Finally, encode with Base58Check
        encrypted_key_nep2 = base58.b58encode_check(bytes(assembled))
        return encrypted_key_nep2.decode("utf-8")
741605
public function setPassword($password)
    {
        if (!$this->salt) {
            $this->salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);
        }
        if ($password) {
            $this->password = $this->getPasswordEncoder()->encodePassword($password, $this->getSalt());
        }

        return $this;
    }
832932
public function secondSign(PrivateKey $keys): self
    {
        $transaction = Hash::sha256($this->toBytes(false));
        $this->signSignature = $keys->sign($transaction)->getBuffer()->getHex();

        return $this;
    }
1164236
public function DKIM_Sign($signHeader)
    {
        if (!defined('PKCS7_TEXT')) {
            if ($this->exceptions) {
                throw new Exception($this->lang('extension_missing') . 'openssl');
            }

            return '';
        }
        $privKeyStr = !empty($this->DKIM_private_string) ?
            $this->DKIM_private_string :
            file_get_contents($this->DKIM_private);
        if ('' != $this->DKIM_passphrase) {
            $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
        } else {
            $privKey = openssl_pkey_get_private($privKeyStr);
        }
        if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) {
            openssl_pkey_free($privKey);

            return base64_encode($signature);
        }
        openssl_pkey_free($privKey);

        return '';
    }
1144846
private function sign($data)
    {
        if (openssl_sign((string)$data, $signature, $this->privateKey->toString(), static::SIGNATURE_ALGORITHM) !== true) {
            throw new \Exception("Could not sign request: " . openssl_error_string());
        }

        return $signature;
    }
101153
public function sign(PrivateKey $keys): self
    {
        $transaction = Hash::sha256($this->toBytes());
        $this->signature = $keys->sign($transaction)->getBuffer()->getHex();

        return $this;
    }