PHP Class Bitpay\PrivateKey

See also: https://en.bitcoin.it/wiki/List_of_address_prefixes
Inheritance: extends bitpay\Key
ファイルを表示 Open project: bitpay/php-client Class Usage Examples

Public Properties

Property Type Description
$pemDecoded array
$pemEncoded string

Protected Properties

Property Type Description
$publicKey PublicKey

Public Methods

Method Description
__toString ( ) : string
generate ( ) : PrivateKey Generates an EC private key
getPublicKey ( ) : PublicKey
hasValidDec ( ) : boolean
hasValidHex ( ) : boolean
isValid ( ) : boolean Checks to see if the private key value is not empty and the hex form only contains hexits and the decimal form only contains devimal digits.
pemDecode ( string $pem_data ) : array Decodes PEM data to retrieve the keypair.
pemEncode ( array $keypair ) : string Encodes keypair data to PEM format.
serializeSig ( $r, $s ) : string ASN.1 DER encodes the signature based on the form: 0x30 + size(all) + 0x02 + size(r) + r + 0x02 + size(s) + s http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
setHex ( $hex ) * Use this method if you have a hex-encoded private key and you want to initialize your private key.
sign ( $data ) : string Creates an ECDSA signature of $message

Method Details

__toString() public method

public __toString ( ) : string
return string

generate() public method

Generates an EC private key
public generate ( ) : PrivateKey
return PrivateKey

getPublicKey() public method

public getPublicKey ( ) : PublicKey
return PublicKey

hasValidDec() public method

public hasValidDec ( ) : boolean
return boolean

hasValidHex() public method

public hasValidHex ( ) : boolean
return boolean

isValid() public method

Checks to see if the private key value is not empty and the hex form only contains hexits and the decimal form only contains devimal digits.
public isValid ( ) : boolean
return boolean

pemDecode() public method

Decodes PEM data to retrieve the keypair.
public pemDecode ( string $pem_data ) : array
$pem_data string The data to decode.
return array The keypair info.

pemEncode() public method

Encodes keypair data to PEM format.
public pemEncode ( array $keypair ) : string
$keypair array The keypair info.
return string The data to decode.

serializeSig() public static method

ASN.1 DER encodes the signature based on the form: 0x30 + size(all) + 0x02 + size(r) + r + 0x02 + size(s) + s http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
public static serializeSig ( $r, $s ) : string
return string

setHex() public method

If you have a private key, you can derive your public key and also your sin.
public setHex ( $hex )

sign() public method

Creates an ECDSA signature of $message
public sign ( $data ) : string
return string

Property Details

$pemDecoded public_oe property

public array $pemDecoded
return array

$pemEncoded public_oe property

public string $pemEncoded
return string

$publicKey protected_oe property

protected PublicKey,bitpay $publicKey
return PublicKey