generate() public method

Generates an uncompressed and compressed EC public key.
public generate ( PrivateKey $privateKey = null ) : Bitpay\PublicKey
$privateKey PrivateKey
return Bitpay\PublicKey
Exemplo n.º 1
0
 /**
  * @return PublicKey
  */
 public function getPublicKey()
 {
     if (null === $this->publicKey) {
         $this->publicKey = new PublicKey();
         $this->publicKey->setPrivateKey($this);
         $this->publicKey->generate();
     }
     return $this->publicKey;
 }
Exemplo n.º 2
0
 public function createBitPayKeys()
 {
     if (_BIT_PAY_PRODUCTION_) {
         $privateKey = new Bitpay\PrivateKey('/tmp/bitpay.pri');
     } else {
         $privateKey = new Bitpay\PrivateKey('/tmp/bitpaydev.pri');
     }
     $privateKey->generate();
     if (_BIT_PAY_PRODUCTION_) {
         $publicKey = new Bitpay\PublicKey('/tmp/bitpay.pub');
     } else {
         $publicKey = new Bitpay\PublicKey('/tmp/bitpaydev.pub');
     }
     $publicKey->setPrivateKey($privateKey);
     $publicKey->generate();
     $storageEngine = new Bitpay\Storage\FilesystemStorage();
     $storageEngine->persist($privateKey);
     $storageEngine->persist($publicKey);
 }