Derive the private key for the given WIF.

@param string                                             $wif
@param \ArkEcosystem\Crypto\Networks\AbstractNetwork|null $network

@return \BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Key\PrivateKey
761932
public static function fromWif(string $wif, AbstractNetwork $network = null): EcPrivateKey
    {
        return (new PrivateKeyFactory())->fromWif($wif, $network);
    }
1305726
public function updateNetwork(\Google\AdsApi\AdManager\v201808\Network $network)
    {
      return $this->__soapCall('updateNetwork', array(array('network' => $network)))->getRval();
    }
483901
public static function fromPassphrase(string $passphrase, AbstractNetwork $network = null): string
    {
        return PrivateKey::fromPassphrase($passphrase)->toWif($network);
    }
297200
def to_wif(network: nil, public_key_compressed: nil)
      BTC::WIF.new(private_key: self, network: network, public_key_compressed: public_key_compressed).to_s
    end
694415
public static PrivateKey getSignCertPrivateKeyByStoreMap(String certPath,
			String certPwd) {
		if (!keyStoreMap.containsKey(certPath)) {
			loadSignCert(certPath, certPwd);
		}
		try {
			Enumeration<String> aliasenum = keyStoreMap.get(certPath)
					.aliases();
			String keyAlias = null;
			if (aliasenum.hasMoreElements()) {
				keyAlias = aliasenum.nextElement();
			}
			PrivateKey privateKey = (PrivateKey) keyStoreMap.get(certPath)
					.getKey(keyAlias, certPwd.toCharArray());
			return privateKey;
		} catch (KeyStoreException e) {
			LogUtil.writeErrorLog("getSignCertPrivateKeyByStoreMap Error", e);
			return null;
		} catch (UnrecoverableKeyException e) {
			LogUtil.writeErrorLog("getSignCertPrivateKeyByStoreMap Error", e);
			return null;
		} catch (NoSuchAlgorithmException e) {
			LogUtil.writeErrorLog("getSignCertPrivateKeyByStoreMap Error", e);
			return null;
		}
	}
1018953
public function getWIFPrivateKey($WIF_address = null)
    {
        if (empty($WIF_address) === true) {
            return ($this->private_key != '') ? $this->private_key : '';
        } else {
            return $this->decodeWIF($WIF_address);
        }
    }
266275
def wif(self, s):
        
        data = self.parse_b58_hashed(s)
        if data is None or not data.startswith(self._wif_prefix):
            return None
        data = data[len(self._wif_prefix):]
        is_compressed = (len(data) > 32)
        if is_compressed:
            data = data[:-1]
        se = from_bytes_32(data)
        return self._network.keys.private(se, is_compressed=is_compressed)
142909
public function write($buf = null)
    {
        if ($buf === null) {
            if ($this->proxyState > 0) {
                return $this->proxyWrite();
            }
            $len = 0;
            if ($this->hasDataToWrite()) {
                $buf = $this->outLen > 0 ? substr($this->outBuf, $this->outLen) : $this->outBuf;
                $len = $this->write($buf);
                if ($len !== false) {
                    $this->outLen += $len;
                }
            }
            return $len;
        }
        $n = @fwrite($this->sock, $buf);
        if ($n === 0 && $this->ioEmptyError()) {
            $n = false;
        }
        $this->ioFlagReset();
        return $n;
    }
330761
static Inet4Address anyInet4Address(final NetworkInterface interf) {
        return AccessController.doPrivileged(new PrivilegedAction<Inet4Address>() {
            public Inet4Address run() {
                Enumeration<InetAddress> addrs = interf.getInetAddresses();
                while (addrs.hasMoreElements()) {
                    InetAddress addr = addrs.nextElement();
                    if (addr instanceof Inet4Address) {
                        return (Inet4Address)addr;
                    }
                }
                return null;
            }
        });
    }
940508
public static function fromString($key)
    {
        //   version (4) || depth (1) || parent fingerprint (4) ||
        //   child num (4) || chain code (32) || key data (33) || checksum (4)
        $payload = DecredNetwork::extendedKeyBase58Decode($key);
        $network = NetworkFactory::fromExtendedKeyVersion(substr($payload, 0, 4));
        $depth = intval(hexdec(substr($payload, 4, 1)));
        $parentFP = substr($payload, 5, 4);
        $childNum = intval(hexdec(substr($payload, 9, 4)));
        $chainCode = substr($payload, 13, 32);
        $key = substr($payload, 45, 33);
        $private = $payload[45] === "\x00";

        return new ExtendedKey($key, $chainCode, $depth, $parentFP, $childNum, $network, $private);
    }
676205
public function privateChildKey($index)
    {
        $key = $this->privateKey();

        if ($index >= self::HARDENED_KEY_START) {
            // Data = 0x00 || ser256(kpar) || ser32(i)).
            // The 0x00 pads the private key to make it 33 bytes long.
            $data = "\x00".str_pad(gmp_export(gmp_import($key)), 32, "\x0", STR_PAD_LEFT).pack('N', $index);
        } else {
            $data = $this->publicKey().pack('N', $index);
        }

        $I = hash_hmac('sha512', $data, $this->chainCode, true);
        $IL = substr($I, 0, (strlen($I) / 2));
        $IR = substr($I, -(strlen($I) / 2));

        Curve::ensureUsableKey(gmp_import($IL));

        $childKey = gmp_export(gmp_mod(gmp_add(gmp_import($IL), gmp_import($key)), Curve::generator()->getOrder()));

        $parentFP = substr(hex2bin(hash('ripemd160', $this->network->hashKey256($this->publicKey()))), 0, 4);

        return new ExtendedKey($childKey, $IR, $this->depth + 1, $parentFP, $index, $this->network, true);
    }
610607
public function exportPrivateKey(PrivateKey $privateKey)
    {
        if (!$privateKey instanceof VirgilPrivateKey) {
            throw new VirgilCryptoException("instance of VirgilPrivateKey expected");
        }

        return base64_encode($this->virgilCrypto->exportPrivateKey($privateKey, $this->password));
    }
1011934
public function getSystemKey()
    {
        return isset($this->encryptedKeys[self::SYSTEM_IDENTIFIER])
            ? $this->encryptedKeys[self::SYSTEM_IDENTIFIER]
            : null;
    }
1004855
public static function generateKeyPair($size = 2048)
    {
        if ($size < 2048) {
            throw new InvalidKeyException('Key size must be at least 2048 bits.');
        }
        $rsa = new RSA();
        $keypair = $rsa->createKey($size);
        return new KeyPair(
            new PrivateKey($keypair['privatekey']),
            new PublicKey($keypair['publickey'])
        );
    }
1357223
public static PrivateKey getPrivateKey(KeyStore keyStore, String alias, String keyPass)
      throws GeneralSecurityException {
    return (PrivateKey) keyStore.getKey(alias, keyPass.toCharArray());
  }
1010776
public static function factory($url, $privateKey = null, $publicKey = null) {
        $url = parent::factory($url);
        $user = self::getUserFromUrl($url->getPath());

        $query = $url->getQuery();
        $currentPublicKey = $query->get('publicKey') ?: false;
        $pubKeysDiffer = $currentPublicKey && $currentPublicKey !== $publicKey;

        if ($privateKey) {
            $url->setPrivateKey($privateKey);

            // If the user and the current public key are the same, remove the public key
            // as it is implied from the user. We can't do this unless we can generate a
            // new accessToken, however, so don't do this unless we have a private key
            if ($user && $user === $currentPublicKey) {
                $url->getQuery()->remove('publicKey');
            }
        }

        // Override the public key if needed, replacing any old public key
        if ($publicKey && ($user !== $publicKey || $pubKeysDiffer)) {
            $url->getQuery()->set('publicKey', $publicKey);
        }

        return $url;
    }
360710
public function getNetworkType($private_key = null)
    {
        $private_key = ($this->testIfWIF($private_key) === true) ? $this->decodeWIF($private_key) : $private_key;
 
        if (empty($private_key) === true) {
            return ($this->network_type != '') ? $this->network_type : '';
        } else {
            return $this->calculateNetworkType($private_key);
        }
    }