PublicKey
        
        extends EC
    
    
            
            in package
            
        
    
            
            implements
                            PublicKey                    
    
            
            uses
                            Fingerprint                    
    
EC Public Key
Tags
Table of Contents
Interfaces
- PublicKey
- PublicKey interface
Constants
- ALGORITHM = 'EC'
- Algorithm Name
Properties
- $context : string
- Context
- $curve : Base
- Curve
- $engines : array<string|int, bool>
- Available Engines
- $format : string
- Signature Format
- $hash : Hash
- Hash function
- $one : BigInteger
- Precomputed One
- $q : BigInteger
- Curve Order
- $QA : array<string|int, object>
- Public Key QA
- $shortFormat : string
- Signature Format (Short)
- $x : BigInteger
- Alias for the private key
- $zero : BigInteger
- Precomputed Zero
- $comment : null|string
- Key Comment
- $curveName : string
- Curve Name
- $hmac : Hash
- HMAC function
- $invisiblePlugins : array<string|int, mixed>
- Invisible plugins
- $plugins : array<string|int, mixed>
- Supported plugins (lower case)
- $signatureFileFormats : array<string|int, mixed>
- Supported signature formats (original case)
- $signatureFormats : array<string|int, mixed>
- Supported signature formats (lower case)
Methods
- __toString() : string
- __toString() magic method
- addFileFormat() : bool
- Add a fileformat plugin
- createKey() : PrivateKey
- Create public / private key pair.
- getComment() : null|string
- Returns the key's comment
- getContext() : mixed
- Returns the signature format currently being used
- getCurve() : string|array<string|int, mixed>
- Returns the curve
- getEncodedCoordinates() : string
- Returns the public key coordinates as a string
- getEngine() : string
- Returns the current engine being used
- getFingerprint() : mixed
- Returns the public key's fingerprint
- getHash() : mixed
- Returns the hash algorithm currently being used
- getLength() : int
- Returns the key size
- getLoadedFormat() : mixed
- Returns the format of the loaded key.
- getParameters() : mixed
- Returns the parameters
- getSignatureFormat() : mixed
- Returns the signature format currently being used
- getSupportedKeyFormats() : array<string|int, mixed>
- Returns a list of supported formats.
- load() : AsymmetricKey
- Load the key
- loadFormat() : AsymmetricKey
- Load the key, assuming a specific format
- loadParameters() : AsymmetricKey
- Loads parameters
- loadParametersFormat() : AsymmetricKey
- Loads parameters
- loadPrivateKey() : PrivateKey
- Loads a private key
- loadPrivateKeyFormat() : PrivateKey
- Loads a private key
- loadPublicKey() : PublicKey
- Loads a public key
- loadPublicKeyFormat() : PublicKey
- Loads a public key
- toString() : string
- Returns the public key
- useBestEngine() : mixed
- Tests engine validity
- useInternalEngine() : mixed
- Flag to use internal engine only (useful for unit testing)
- verify() : mixed
- Verify a signature
- withContext() : mixed
- Sets the context
- withHash() : mixed
- Determines which hashing function should be used
- withSignatureFormat() : mixed
- Determines the signature padding mode
- __construct() : mixed
- Constructor
- bits2int() : BigInteger
- Bit String to Integer
- computek() : string
- Compute the pseudorandom k for signature generation, using the process specified for deterministic DSA.
- initialize_static_variables() : mixed
- Initialize static variables
- onLoad() : bool
- OnLoad Handler
- validatePlugin() : mixed
- Validate Plugin
- bits2octets() : string
- Bit String to Octet String
- int2octets() : string
- Integer to Octet String
- loadPlugins() : mixed
- Load Plugins
Constants
ALGORITHM
Algorithm Name
    public
        string
    ALGORITHM
    = 'EC'
    
    
    
    Tags
Properties
$context
Context
    protected
        string
    $context
    
    
    
    
    
$curve
Curve
    protected
        Base
    $curve
    
    
    
    
    
$engines
Available Engines
    protected
    static    array<string|int, bool>
    $engines
     = []
    
    
    
    Tags
$format
Signature Format
    protected
        string
    $format
    
    
    
    
    Tags
$hash
Hash function
    protected
        Hash
    $hash
    
    
    
    
    Tags
$one
Precomputed One
    protected
    static    BigInteger
    $one
    
    
    
    
    Tags
$q
Curve Order
    protected
        BigInteger
    $q
    
        Used for deterministic ECDSA
$QA
Public Key QA
    protected
        array<string|int, object>
    $QA
    
    
    
    
    
$shortFormat
Signature Format (Short)
    protected
        string
    $shortFormat
    
    
    
    
    Tags
$x
Alias for the private key
    protected
        BigInteger
    $x
    
        Used for deterministic ECDSA. AsymmetricKey expects $x. I don't like x because with x you have x * the base point yielding an (x, y)-coordinate that is the public key. But the x is different depending on which side of the equal sign you're on. It's less ambiguous if you do dA * base point = (x, y)-coordinate.
$zero
Precomputed Zero
    protected
    static    BigInteger
    $zero
    
    
    
    
    Tags
$comment
Key Comment
    private
        null|string
    $comment
    
    
    
    
    Tags
$curveName
Curve Name
    private
        string
    $curveName
    
    
    
    
    
$hmac
HMAC function
    private
        Hash
    $hmac
    
    
    
    
    Tags
$invisiblePlugins
Invisible plugins
    private
    static    array<string|int, mixed>
    $invisiblePlugins
     = []
    
    
    
    Tags
$plugins
Supported plugins (lower case)
    private
    static    array<string|int, mixed>
    $plugins
     = []
    
    
    
    Tags
$signatureFileFormats
Supported signature formats (original case)
    private
    static    array<string|int, mixed>
    $signatureFileFormats
     = []
    
    
    
    Tags
$signatureFormats
Supported signature formats (lower case)
    private
    static    array<string|int, mixed>
    $signatureFormats
     = []
    
    
    
    Tags
Methods
__toString()
__toString() magic method
    public
                    __toString() : string
    Return values
stringaddFileFormat()
Add a fileformat plugin
    public
            static        addFileFormat(string $fullname) : bool
    The plugin needs to either already be loaded or be auto-loadable. Loading a plugin whose shortname overwrite an existing shortname will overwrite the old plugin.
Parameters
- $fullname : string
Tags
Return values
boolcreateKey()
Create public / private key pair.
    public
            static        createKey(string $curve) : PrivateKey
    Parameters
- $curve : string
Tags
Return values
PrivateKeygetComment()
Returns the key's comment
    public
                    getComment() : null|string
    Not all key formats support comments. If you want to set a comment use toString()
Tags
Return values
null|stringgetContext()
Returns the signature format currently being used
    public
                    getContext() : mixed
    Tags
getCurve()
Returns the curve
    public
                    getCurve() : string|array<string|int, mixed>
    Returns a string if it's a named curve, an array if not
Tags
Return values
string|array<string|int, mixed>getEncodedCoordinates()
Returns the public key coordinates as a string
    public
                    getEncodedCoordinates() : string
    Used by ECDH
Return values
stringgetEngine()
Returns the current engine being used
    public
                    getEngine() : string
    Tags
Return values
stringgetFingerprint()
Returns the public key's fingerprint
    public
                    getFingerprint([string $algorithm = 'md5' ]) : mixed
    The public key's fingerprint is returned, which is equivalent to running ssh-keygen -lf rsa.pub. If there is
no public key currently loaded, false is returned.
Example output (md5): "c1:b1:30:29:d7:b8:de:6c:97:77:10:d7:46:41:63:87" (as specified by RFC 4716)
Parameters
- $algorithm : string = 'md5'
- 
                    The hashing algorithm to be used. Valid options are 'md5' and 'sha256'. False is returned for invalid values. 
Tags
getHash()
Returns the hash algorithm currently being used
    public
                    getHash() : mixed
    Tags
getLength()
Returns the key size
    public
                    getLength() : int
    Quoting https://tools.ietf.org/html/rfc5656#section-2,
"The size of a set of elliptic curve domain parameters on a prime curve is defined as the number of bits in the binary representation of the field order, commonly denoted by p. Size on a characteristic-2 curve is defined as the number of bits in the binary representation of the field, commonly denoted by m. A set of elliptic curve domain parameters defines a group of order n generated by a base point P"
Tags
Return values
intgetLoadedFormat()
Returns the format of the loaded key.
    public
                    getLoadedFormat() : mixed
    If the key that was loaded wasn't in a valid or if the key was auto-generated with RSA::createKey() then this will throw an exception.
Tags
getParameters()
Returns the parameters
    public
                    getParameters([string $type = 'PKCS1' ]) : mixed
    Parameters
- $type : string = 'PKCS1'
- 
                    optional 
Tags
getSignatureFormat()
Returns the signature format currently being used
    public
                    getSignatureFormat() : mixed
    Tags
getSupportedKeyFormats()
Returns a list of supported formats.
    public
            static        getSupportedKeyFormats() : array<string|int, mixed>
    Tags
Return values
array<string|int, mixed>load()
Load the key
    public
            static        load(string $key[, string $password = false ]) : AsymmetricKey
    Parameters
- $key : string
- $password : string = false
- 
                    optional 
Return values
AsymmetricKeyloadFormat()
Load the key, assuming a specific format
    public
            static        loadFormat(string $type, string $key[, string $password = false ]) : AsymmetricKey
    Parameters
- $type : string
- $key : string
- $password : string = false
- 
                    optional 
Return values
AsymmetricKeyloadParameters()
Loads parameters
    public
                    loadParameters(string|array<string|int, mixed> $key) : AsymmetricKey
    Parameters
- $key : string|array<string|int, mixed>
Tags
Return values
AsymmetricKeyloadParametersFormat()
Loads parameters
    public
                    loadParametersFormat(string $type, string|array<string|int, mixed> $key) : AsymmetricKey
    Parameters
- $type : string
- $key : string|array<string|int, mixed>
Tags
Return values
AsymmetricKeyloadPrivateKey()
Loads a private key
    public
                    loadPrivateKey(string|array<string|int, mixed> $key[, string $password = '' ]) : PrivateKey
    Parameters
- $key : string|array<string|int, mixed>
- $password : string = ''
- 
                    optional 
Tags
Return values
PrivateKeyloadPrivateKeyFormat()
Loads a private key
    public
                    loadPrivateKeyFormat(string $type, string $key[, string $password = false ]) : PrivateKey
    Parameters
- $type : string
- $key : string
- $password : string = false
- 
                    optional 
Tags
Return values
PrivateKeyloadPublicKey()
Loads a public key
    public
                    loadPublicKey(string|array<string|int, mixed> $key) : PublicKey
    Parameters
- $key : string|array<string|int, mixed>
Tags
Return values
PublicKeyloadPublicKeyFormat()
Loads a public key
    public
                    loadPublicKeyFormat(string $type, string $key) : PublicKey
    Parameters
- $type : string
- $key : string
Tags
Return values
PublicKeytoString()
Returns the public key
    public
                    toString(string $type[, array<string|int, mixed> $options = [] ]) : string
    Parameters
- $type : string
- $options : array<string|int, mixed> = []
- 
                    optional 
Return values
stringuseBestEngine()
Tests engine validity
    public
            static        useBestEngine() : mixed
    Tags
useInternalEngine()
Flag to use internal engine only (useful for unit testing)
    public
            static        useInternalEngine() : mixed
    Tags
verify()
Verify a signature
    public
                    verify(string $message, string $signature) : mixed
    Parameters
- $message : string
- $signature : string
Tags
withContext()
Sets the context
    public
                    withContext([string $context = null ]) : mixed
    Used by Ed25519 / Ed448.
Parameters
- $context : string = null
- 
                    optional 
Tags
withHash()
Determines which hashing function should be used
    public
                    withHash(string $hash) : mixed
    Parameters
- $hash : string
Tags
withSignatureFormat()
Determines the signature padding mode
    public
                    withSignatureFormat(string $format) : mixed
    Valid values are: ASN1, SSH2, Raw
Parameters
- $format : string
Tags
__construct()
Constructor
    protected
                    __construct() : mixed
    PublicKey and PrivateKey objects can only be created from abstract RSA class
bits2int()
Bit String to Integer
    protected
                    bits2int(string $in) : BigInteger
    Parameters
- $in : string
Tags
Return values
BigIntegercomputek()
Compute the pseudorandom k for signature generation, using the process specified for deterministic DSA.
    protected
                    computek(string $h1) : string
    Parameters
- $h1 : string
Tags
Return values
stringinitialize_static_variables()
Initialize static variables
    protected
            static        initialize_static_variables() : mixed
    onLoad()
OnLoad Handler
    protected
            static        onLoad(array<string|int, mixed> $components) : bool
    Parameters
- $components : array<string|int, mixed>
Tags
Return values
boolvalidatePlugin()
Validate Plugin
    protected
            static        validatePlugin(string $format, string $type[, string $method = NULL ]) : mixed
    Parameters
- $format : string
- $type : string
- $method : string = NULL
- 
                    optional 
Tags
bits2octets()
Bit String to Octet String
    private
                    bits2octets(string $in) : string
    Parameters
- $in : string
Tags
Return values
stringint2octets()
Integer to Octet String
    private
                    int2octets(BigInteger $v) : string
    Parameters
- $v : BigInteger
Tags
Return values
stringloadPlugins()
Load Plugins
    private
            static        loadPlugins(string $format) : mixed
    Parameters
- $format : string