Skip to content

Commit

Permalink
Cleanup readme, examples
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Apr 29, 2024
1 parent a6d4cab commit a064445
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ be secure.
In the meantime, **DO NOT** submit bug bounty reports to us for this code. They will be
closed as out of scope. File an Issue here instead!

### This Library Implements Low-Level Elliptic Curve Cryptography

If you just need Diffie-Hellman or ECDSA, you should install [EasyECC](https://github.com/paragonie/easy-ecc/)
instead of working with this library directly. EasyECC was designed to use PHPECC
in a secure-by-default manner.

### Information

This library is a rewrite/update of Matyas Danter's ECC library. All credit goes to him.
Expand Down
4 changes: 2 additions & 2 deletions examples/creating_signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// which a verifier must be aware of.

$adapter = EccFactory::getAdapter();
$generator = EccFactory::getNistCurves()->generator384();
$generator = EccFactory::getNistCurves()->generator256(null, true);
$useDerandomizedSignatures = true;
$algorithm = 'sha256';

Expand All @@ -27,7 +27,7 @@
$hasher = new SignHasher($algorithm, $adapter);
$hash = $hasher->makeHash($document, $generator);

# Derandomized signatures are not necessary, but is avoids
# Derandomized signatures are not necessary, but it avoids
# the risk of a low entropy RNG, causing accidental reuse
# of a k value for a different message, which leaks the
# private key.
Expand Down
2 changes: 1 addition & 1 deletion examples/ecdh_exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// which a verifier must be aware of.

$adapter = EccFactory::getAdapter();
$generator = EccFactory::getNistCurves()->generator384();
$generator = EccFactory::getNistCurves()->generator256(null, true);
$useDerandomizedSignatures = true;

$derPub = new DerPublicKeySerializer();
Expand Down
2 changes: 1 addition & 1 deletion examples/key_generation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Mdanter\Ecc\Serializer\PrivateKey\DerPrivateKeySerializer;

$adapter = EccFactory::getAdapter();
$generator = EccFactory::getNistCurves()->generator384();
$generator = EccFactory::getNistCurves()->generator256(null, true);
$private = $generator->createPrivateKey();

$derSerializer = new DerPrivateKeySerializer($adapter);
Expand Down
2 changes: 1 addition & 1 deletion examples/verify_signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Same parameters as creating_signature.php

$adapter = EccFactory::getAdapter();
$generator = EccFactory::getNistCurves()->generator384();
$generator = EccFactory::getNistCurves()->generator256(null, true);
$algorithm = 'sha256';
$sigData = base64_decode('MEQCIHK+HXgq0AjeKfmdI9l4uGBL0keIiZiQOCEyij25B/X/AiAQs++18Vhb0Q9tqWjzWUNTAMLEzUKF0XzKyHQ028/q4Q==');
$document = 'I am writing today...';
Expand Down
2 changes: 1 addition & 1 deletion validate_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ for i in examples/*.php; do
php $i
if [ $? != 0 ]; then
echo "Error running example code";
exit -1
exit 255
fi;
done

0 comments on commit a064445

Please sign in to comment.