From fe80fb48d3e78e10e3dba2a36cc1bc1fcfaede06 Mon Sep 17 00:00:00 2001 From: Bill Buchanan Date: Mon, 17 Feb 2025 11:25:10 +0000 Subject: [PATCH 1/2] Update README.md --- unit04_public_key/lab/README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/unit04_public_key/lab/README.md b/unit04_public_key/lab/README.md index 98af23f..ad776d1 100644 --- a/unit04_public_key/lab/README.md +++ b/unit04_public_key/lab/README.md @@ -71,15 +71,6 @@ Using the following Web page, determine the owner of the key, and the ID on the [https://asecuritysite.com/encryption/pgp1](https://asecuritysite.com/pgp/pgp1) -Now, save the file to newpub.gpg on your Ubuntu instance, and then determine the information that is provided with the command: - -``` -gpg newpub.gpg -``` - -By searching on-line, can you find the public key of three famous people, and view their key details, and can you discover some of the details of their keys (eg User ID, key encryption method, key size, etc)? - - By searching on-line, what is an ASCII Armored Message? From e3bad3bfe0e9d8605bf1dc9123236b9ad1a4fda1 Mon Sep 17 00:00:00 2001 From: Bill Buchanan Date: Mon, 17 Feb 2025 12:03:16 +0000 Subject: [PATCH 2/2] Update README.md --- unit04_public_key/lab/README.md | 48 --------------------------------- 1 file changed, 48 deletions(-) diff --git a/unit04_public_key/lab/README.md b/unit04_public_key/lab/README.md index ad776d1..7d8d4b4 100644 --- a/unit04_public_key/lab/README.md +++ b/unit04_public_key/lab/README.md @@ -313,55 +313,7 @@ How does secp128k1, secp256k1 and secp512r1 different in the parameters used? Pe If you want to see an example of ECC, try [here](https://asecuritysite.com/encryption/ecc) ## D Elliptic Curve Encryption -### D.1 -In the following Bob and Alice create elliptic curve key pairs. Bob can encrypt a message for Alice with her public key, and she can decrypt with her private key. Copy and paste the program from here: -https://asecuritysite.com/encryption/elc - -Code used: - -```python -from cryptography.hazmat.primitives.asymmetric import ec -from cryptography.hazmat.primitives import serialization -import binascii -import sys - -private_key = ec.generate_private_key(ec.SECP256K1()) - - -vals = private_key.private_numbers() -no_bits=vals.private_value.bit_length() -print (f"Private key value: {vals.private_value}. Number of bits {no_bits}") - -public_key = private_key.public_key() -vals=public_key.public_numbers() - -enc_point=binascii.b2a_hex(vals.encode_point()).decode() - -print (f"\nPublic key encoded point: {enc_point} \nx={enc_point[2:(len(enc_point)-2)//2+2]} \ny={enc_point[(len(enc_point)-2)//2+2:]}") - - -pem = private_key.private_bytes(encoding=serialization.Encoding.PEM,format=serialization.PrivateFormat.PKCS8,encryption_algorithm=serialization.NoEncryption()) - -der = private_key.private_bytes(encoding=serialization.Encoding.DER,format=serialization.PrivateFormat.PKCS8,encryption_algorithm=serialization.NoEncryption()) - - - -print ("\nPrivate key (PEM):\n",pem.decode()) -print ("Private key (DER):\n",binascii.b2a_hex(der)) - -pem = public_key.public_bytes(encoding=serialization.Encoding.PEM,format=serialization.PublicFormat.SubjectPublicKeyInfo) - -der = public_key.public_bytes(encoding=serialization.Encoding.DER,format=serialization.PublicFormat.SubjectPublicKeyInfo) - -print ("\nPublic key (PEM):\n",pem.decode()) -print ("Public key (DER):\n",binascii.b2a_hex(der)) - -``` - -For a message of “Hello. Alice”, what is the ciphertext sent (just include the first four characters): - -**NOTE**: Python 3.5 is not working using the above code example. Please use Python 3.8 ! ### D.2