bcp1 0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
bcp1/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ from importlib.resources import files
2
+ print(files("bcp1").joinpath("data.txt").read_text())
bcp1/data.txt ADDED
@@ -0,0 +1,46 @@
1
+ from cryptography.hazmat.primitives.asymmetric import rsa, padding
2
+ from cryptography.hazmat.primitives import hashes, serialization
3
+
4
+ # Generate keys
5
+ private_key = rsa.generate_private_key(
6
+ public_exponent=65537,
7
+ key_size=2048
8
+ )
9
+
10
+ public_key = private_key.public_key()
11
+
12
+ # Message
13
+ message = b"Hello, this is a digital message."
14
+
15
+ # Sign the message
16
+ signature = private_key.sign(
17
+ message,
18
+ padding.PKCS1v15(),
19
+ hashes.SHA256()
20
+ )
21
+
22
+ print("Signature created successfully.")
23
+
24
+ # Verify the signature
25
+ try:
26
+ public_key.verify(
27
+ signature,
28
+ message,
29
+ padding.PKCS1v15(),
30
+ hashes.SHA256()
31
+ )
32
+
33
+ print("Signature Verified Successfully.")
34
+
35
+ except:
36
+ print("Signature verification failed.")
37
+
38
+
39
+ # Convert public key into PEM format
40
+ public_pem = public_key.public_bytes(
41
+ encoding=serialization.Encoding.PEM,
42
+ format=serialization.PublicFormat.SubjectPublicKeyInfo
43
+ )
44
+
45
+ print("\nPublic key:")
46
+ print(public_pem.decode())
@@ -0,0 +1,3 @@
1
+ Metadata-Version: 2.4
2
+ Name: bcp1
3
+ Version: 0.1
@@ -0,0 +1,6 @@
1
+ bcp1/__init__.py,sha256=fg8kwBZj0vpd7cj1biDvxE3y6pyHi36-vFgkO3wqmsA,94
2
+ bcp1/data.txt,sha256=i9Lg1dGEw3bvFCVpDGquKy5JnzDQjCrA6-tmdl2y_ZA,1004
3
+ bcp1-0.1.dist-info/METADATA,sha256=AvpZi8nAYAEd1TdW4EmYilfV7cGkz4V5yNoRChqRk-8,49
4
+ bcp1-0.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
5
+ bcp1-0.1.dist-info/top_level.txt,sha256=VlelUvLGQOtGZ_n3BSlyiPFphX0R1Uc7eRdjH3viBpk,5
6
+ bcp1-0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ bcp1