Skip to main content

py25519

Python wrapper around curve25519 by mehdi sotoodeh. The files under py25519/c are from mehdi sotoodeh and are copied unchanged from https://github.com/msotoodeh/curve25519.

LICENSE

The files under py25519/c are licensed under the MIT LICENSE (see license.txt file under py25519/c).

All remaining files in this package are licensed under the GNU General Public License version 3 or (at your option) any later version.

See the file LICENSE-GPLv3.txt for details of the GNU General Public License version 3.

Class Documentation

class Key25519(__builtin__.object)
      __init__(self, secretkey=None, verifyingkey=None, pubkey=None)
        '''
          secretkey-->bytes[32]
            verifyingkey-->bytes[32]
          pubkey-->bytes[32]

          A PublicKey version of the object will have ONLY verifyingkey
          and pubkey and signingkey will be None
          A PrivateKey version of the object will have secretkey set
          and verifyingkey and pubkey are ignored and derived from secretkey

          Storing and reusing the secretkey is a way to recreate your key pair
        '''

      get_ecdh_key(self, other)
        '''
          other-->Key25519 instance
        '''

      public_key(self)
        '''
          Returns a PublicKey version of this object
        '''

      selftest(self)
        '''
          Returns-->boolean
        '''

      serialize(self)

      sign = wrapped(*args, **kwargs)

      verify = wrapped(*args, **kwargs)

      # ---------------------------------------------------------------------
      # Properties (data descriptors)
      # ---------------------------------------------------------------------

      pubkey

      secretkey

      signingkey

      verifyingkey

Simple test

see py25519.test.py

from py25519 import Key25519


c = Key25519()
print('secretkey: ', c.secretkey)
print('signingkey: ', c.signingkey)
print('verifyingkey: ', c.verifyingkey)

msg = 'Hello world'
badmsg = msg + '1'
sig = c.sign(msg)
badsig = c.sign(badmsg)
print('good verify: ', c.verify(sig, msg))
print('badmsg verify: ', c.verify(sig, badmsg))
print('badsig verify: ', c.verify(badsig, msg))

d = Key25519(secretkey=c.secretkey)
print('----- d is a copy of c -----')
print('d.verify: ', d.verify(sig, msg))
print('c == d:', c == d)
print('public(c) == public(d):', c.public_key() == d.public_key())
print('c == public(d):', c == d.public_key())

print('----- e is a new different key -----')
e = Key25519()
print('e.verify: ', e.verify(sig, msg))
print('c == e:', c == e)
print('public(c) == public(e):', c.public_key() == e.public_key())

print('----- Test ECDH shared key -----')
ecdh1 = c.get_ecdh_key(e.public_key())
ecdh2 = e.get_ecdh_key(c.public_key())
print('ecdh equal: ', ecdh1 == ecdh2)
ecdh3 = e.get_ecdh_key(c.public_key())
print('ecdh equal again: ', ecdh1 == ecdh3)

Release files for py25519 0.13.28

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py25519 0.13.28
File Size Uploaded
py25519-0.13.28.tar.gz 120.3 kB Details

Release files / py25519-0.13.28.tar.gz

Download URL py25519-0.13.28.tar.gz
Size 120.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e6ab97d8bac7c66359e3d333c661e0f96011f0d481b8ff4a469b517085ce5955
BLAKE2b-256 checksum
How to use checksums
72f41e9fe7e8bb8ab8c5be86b77b9cd6ed7a6d6197259162610a0f2655834375
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.13.28 This release

1 release file

0.13.22

1 release file

0.13.21

1 release file

0.13.20

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page