[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/phpseclib/phpseclib/phpseclib/Crypt/DSA/ -> PrivateKey.php (summary)

DSA Private Key

Author: Jim Wigginton <[email protected]>
Copyright: 2015 Jim Wigginton
License: http://www.opensource.org/licenses/mit-license.html MIT License
File Size: 159 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

PrivateKey:: (3 methods):
  getPublicKey()
  sign()
  toString()


Class: PrivateKey  - X-Ref

DSA Private Key

getPublicKey()   X-Ref
Returns the public key

If you do "openssl rsa -in private.rsa -pubout -outform PEM" you get a PKCS8 formatted key
that contains a publicKeyAlgorithm AlgorithmIdentifier and a publicKey BIT STRING.
An AlgorithmIdentifier contains an OID and a parameters field. With RSA public keys this
parameters field is NULL. With DSA PKCS8 public keys it is not - it contains the p, q and g
variables. The publicKey BIT STRING contains, simply, the y variable. This can be verified
by getting a DSA PKCS8 public key:

"openssl dsa -in private.dsa -pubout -outform PEM"

ie. just swap out rsa with dsa in the rsa command above.

A PKCS1 public key corresponds to the publicKey portion of the PKCS8 key. In the case of RSA
the publicKey portion /is/ the key. In the case of DSA it is not. You cannot verify a signature
without the parameters and the PKCS1 DSA public key format does not include the parameters.

return: mixed

sign($message)   X-Ref
Create a signature

param: string $message
return: mixed

toString($type, array $options = [])   X-Ref
Returns the private key

param: string $type
param: array $options optional
return: string



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer