-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OQS rand API support
- Loading branch information
Showing
15 changed files
with
376 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Version 0.2.1 - January 22, 2020 | ||
- Added a signature example | ||
- Added partial support for RNGs from <oqs/rand.h> | ||
- Added an RNG example | ||
|
||
Version 0.2.0 - October 8, 2019 | ||
- This release updates for compatibility with liboqs 0.2.0, which contains | ||
new/updated algorithms based on NIST Round 2 submissions. | ||
|
||
Version 0.1.0 - April 23, 2019 | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
liboqs-python version 0.2.0 | ||
liboqs-python version 0.2.1 | ||
=========================== | ||
|
||
About | ||
----- | ||
|
||
The **Open Quantum Safe (OQS) project** has the goal of developing and prototyping quantum-resistant cryptography. More information on OQS can be found on our website: https://openquantumsafe.org/ and on Github at https://github.com/open-quantum-safe/. | ||
The **Open Quantum Safe (OQS) project** has the goal of developing and prototyping quantum-resistant cryptography. More information on OQS can be found on our website: https://openquantumsafe.org/ and on Github at https://github.com/open-quantum-safe/. | ||
|
||
**liboqs** is an open source C library for quantum-resistant cryptographic algorithms. See more about liboqs at [https://github.com/open-quantum-safe/liboqs/](https://github.com/open-quantum-safe/liboqs/), including a list of supported algorithms. | ||
**liboqs** is an open source C library for quantum-resistant cryptographic algorithms. See more about liboqs at [https://github.com/open-quantum-safe/liboqs/](https://github.com/open-quantum-safe/liboqs/), including a list of supported algorithms. | ||
|
||
**liboqs-python** is an open source Python 3 wrapper for the liboqs C library for quantum-resistant cryptographic algorithms. Details about liboqs-python can be found in [README.md](https://github.com/open-quantum-safe/liboqs-python/blob/master/README.md). See in particular limitations on intended use. | ||
**liboqs-python** is an open source Python 3 wrapper for the liboqs C library for quantum-resistant cryptographic algorithms. Details about liboqs-python can be found in [README.md](https://github.com/open-quantum-safe/liboqs-python/blob/master/README.md). See in particular limitations on intended use. | ||
|
||
Release notes | ||
============= | ||
|
||
This release of liboqs-python was released on October 8, 2019. Its release page on GitHub is https://github.com/open-quantum-safe/liboqs-python/releases/tag/0.2.0. | ||
This release of liboqs-python was released on January 22, 2020. Its release page on GitHub is https://github.com/open-quantum-safe/liboqs-python/releases/tag/0.2.1. | ||
|
||
What's New | ||
---------- | ||
|
||
This is the second release of liboqs-python. | ||
This is the third release of liboqs-python. | ||
|
||
This release updates for compatibility with liboqs 0.2.0, which contains new/updated algorithms based on NIST Round 2 submissions. | ||
This release added partial support for RNGs from `<oqs/rand.h>`, together with a signature example and an RNG example. | ||
|
||
For a list of changes see [CHANGES.txt](https://github.com/open-quantum-safe/liboqs-python/blob/master/CHANGES.txt). |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# key encapsulation Python example | ||
|
||
from pprint import pprint | ||
import oqs | ||
|
||
####################################################################### | ||
# KEM example | ||
####################################################################### | ||
|
||
kems = oqs.get_enabled_KEM_mechanisms() | ||
|
||
print('Enabled KEM mechanisms:') | ||
pprint(kems) | ||
|
||
# create client and server with default KEM mechanisms | ||
kemalg = "DEFAULT" | ||
with oqs.KeyEncapsulation(kemalg) as client: | ||
with oqs.KeyEncapsulation(kemalg) as server: | ||
print("\nKey encapsulation details:") | ||
pprint(client.details) | ||
|
||
# client generates its keypair | ||
public_key = client.generate_keypair() | ||
# optionally, the secret key can be obtained by calling export_secret_key() | ||
# and the client can later be re-instantiated with the key pair: | ||
# secret_key = client.export_secret_key() | ||
# store key pair, wait... (session resumption): | ||
# client = oqs.KeyEncapsulation(kemalg, secret_key) | ||
|
||
# the server encapsulates its secret using the client's public key | ||
ciphertext, shared_secret_server = server.encap_secret(public_key) | ||
|
||
# the client decapsulates the the server's ciphertext to obtain the shared secret | ||
shared_secret_client = client.decap_secret(ciphertext) | ||
|
||
print("\nShared secretes coincide:", shared_secret_client == shared_secret_server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# various RNGs Python example | ||
|
||
import oqs.rand as oqsrand # must be explicitly imported | ||
|
||
####################################################################### | ||
# randomness example | ||
####################################################################### | ||
|
||
# set the entropy seed to some random values | ||
entropy_seed = [0] * 48 | ||
entropy_seed[0] = 100 | ||
entropy_seed[20] = 200 | ||
entropy_seed[47] = 150 | ||
|
||
oqsrand.randombytes_nist_kat_init(bytes(entropy_seed)) | ||
oqsrand.randombytes_switch_algorithm('NIST-KAT') | ||
print('{:17s}'.format("NIST-KAT:"), ' '.join('{:02X}'.format(x) for x in oqsrand.randombytes(32))) | ||
|
||
oqsrand.randombytes_switch_algorithm("OpenSSL") | ||
print('{:17s}'.format("OpenSSL:"), ' '.join('{:02X}'.format(x) for x in oqsrand.randombytes(32))) | ||
|
||
oqsrand.randombytes_switch_algorithm("system") | ||
print('{:17s}'.format("System (default):"), ' '.join('{:02X}'.format(x) for x in oqsrand.randombytes(32))) |
Oops, something went wrong.