Professional Documents
Culture Documents
u0349111
CS 4480: Computer Networks
PA3-B Report
April 25, 2016
Design
I changed my design at least 3 times and ended up settling with the command line implementation.
Sadly, time was not a luxury either. A constraint that would have helped my design the socket
programming part much better. My simple protocol:
Bob starts his program first on a given port from the command line. He acts as a server, listening for
Alice to connect to him. Bob expects a “hello message” from Alice. This happens as a line Alice
enters that must match “Hello Bob. This is Alice.”.
When Alice starts her program, she gives the IP address and port of Bob on the command line. Bob
will then send her his public key signed with the certificate authority’s secret key. This “package”
will be received as a tarball file and Alice will “open the package and verify the Bob key using the
public key of the certificate authority. Alice must run her program again and enter message to Bob
prepended with “MESSAGE: “. The message will then be signed using Alice’s private key and hashed
with SHA1. This will be packaged in a tarball file and then symmetric keys will be generated that is
used to encrypt the tarball file the symmetric key information is also encrypted using Bob’s public
key and the two files are packaged into another tarball file that is sent to Bob.
Testing
I had a difficult time finding out the exact order and syntax for the entire process. I spent the first
12 hours or so with this. I had the luxury of using 2 MacBook to test the programs on. I started Bob
on one MacBook and then Alice on the other so that I could properly test the socket connections.
Once I had the implementation working confidently, I remoted (ssh) in to the cade lab and did the
same process. There are some situations that I didn’t gracefully handle. For example, sending a
hello message 2 times in a row doesn’t isn’t handle well. I stopped and started Bob again to fix this.
Output that shows output that illustrates the correct functioning of your program.
These are both with verbose (-v) on. Verbose prints the contents of the files that are encrypted and decrypted.
##################### BOB ##########################
����
zdvG��}����j�
��
w�ؠP�7��K�
mj��*��RG�>0��!t��m��O���L.���]7���XἝ�<13����,��ú��7O��0N~_�ݮO�qo-���=Ȟ
*******************************************************************************************
Packaging Bob's signed public key in a tarball
*******************************************************************************************
*******************************************************************************************
Sending public_key_digest.tar (10240 bytes)
File sent.
Connected to alice.
File received_files/encrypted_message_package.tar downloaded (20480 bytes read)
*******************************************************************************************
Open the message package
*******************************************************************************************
Decrypt the symmetrical key information with Bob's private key.
salt=98F70CFEB6A275A5
key=F5BAEF6A32049BE4CB6423821E046C253CCAC78F266607C9
iv =5731C611E0BA3392
*******************************************************************************************
Decrypt the message digest package with the symmetrical key information.
*******************************************************************************************
Unpackage the message digest.
��ƣ��1�;�-x�?F� �.QQQ��j=��[��P�{�@����J7
�Ŷ[^�רH;�,��L��Ki� �t��Ǡ_S��}Z�������م,���!���f�2IZ\W/C��
�y��3�@� ��
*******************************************************************************************
Message form Alice:
Bob, you are my bae. <3 <3 <3
����
zdvG�� }���� j�
��
w�ؠP�7�� K�
mj�� *�� RG�>0��!t�� m�� O���L.��� ]7��� XἝ�<13���� ,��ú��7O��0N~_�ݮO�qo-���=Ȟ
*******************************************************************************************
Verifying Bob's public key with the certificate authority's public key
Verified OK
salt=98F70CFEB6A275A5
key=F5BAEF6A32049BE4CB6423821E046C253CCAC78F266607C9
iv =5731C611E0BA3392
*******************************************************************************************
Use the symmetric key information to encrypt the message digest
�(V�m ���~r�ƒ�� c/K�KP���'���� -�.�,��� uƝ
W&�>�� E�����l�?�-�J��0̥�P�l�::�\g�K֙��� W�`n���� Z-D9���� Ґ~���m8�^�,
�~>)�<�R��� EB9z]oEWz�zz�>�m��E�[C���� f�
�Ye~�� �� Z�}�Μ{iyE�� A�m�l���� ~���D��؟Dxn�� 2��� }Ў��˗��� u(eoQwqP��.�'�_Y
9zA�=7�̾���� f!�yP2MfZ�� J�_���"2 >\E�d����k���V�sk&Z���f ^�~��S�b���� v�
� #ot���h9e{{�.k6�����r�p�*�H`������S
*�u�o�4�A�1}���� Y�C�RnP�1"��cL�Ѝ�)�r���o��p�%&e��>��O���"�ȕ�7��s�:�� X���5n�k/t@�T9�&V
$yh���� !e#�7F����+]�|<�����ASG�� _"o��\��i�G趽b�E���>�DV�� C�G�Z�Vj9�ƴü�� Oq���|�.
�s�n#;ᡖI�Q����roJ���e�{Yd^ԽnvW�zmBE=�� =/?�ϩ�� "cE�Ͽ�yw�3?J�5�� P�>g�e�
d�� sZ�.KL)l�χ g_��� :���y���_
�+����~�PS�� FQ◌��� ƫ <��aF�T�O�O�c�� h�Q������ V!-]ѯ1�m�o��
b�~�:�Ę��iʇ�&y#7���F
���� `���� [oXM˻����c�� V�� )�� m|/�;9!�Kq�c�*�� \��Z,�� Z`$U�t�� O��D�&����Ѻ�u�դ�� W=�0l/:���WF�� k��
?%��/f
�P�[�
�� .u���Xh��m�!�C;E/!'q�K���'�>�S�Ul���2P\M�5�;{N8p8x�}N�
�%�� ˛�Ut7P
�� ҍ�� U2���=�h}0��<=�
�� 36v��w��� X�I�t&�`P�^$�F�� M)Z���t�p��a�SA3z�7�S*�#���ϖ˺_5/bC�� %�d�Ƈ���o�� լI\����<�,:
���� ۱��]#'���+�� W�`�� 2GC��u��
�<�L��� |�`�1��4 �
�w/Y|>O6�Q=�&�N���%V�)����
k�O�����09`��[�:
��
d
H�U!�,�"�� 2)zK|]]���`�\��4���� X_:���R�0u`��+v9y��p�� U�5ª��DɫU���� |zs��� P{��
T�g�rϸ�� >�*X*��� [s���
@m��
uQ�lU&ͨ�}
H��ax���1��� _�s��O�c4��� A�7y&�w��8\رɝp�D�� n�*N��� T0whx��wm�|H����� R�
�T^���� H�� D��A��h◌ۜ��i��"t6�O<cW�� [=�\�f�� N�|��8��k1e�x��8+I�;��� -�%�1`WI'�16�� 7��ir��-
�BPS�� {�NGq9�G
�e���0(�73�ȱu8<�w��0���3A�I���NA�� &F|S~��� c%�`�
3�}UU��
C%d�'SYA����������� j�U'�_�o
L�&� �B�m-K�}��&�^�
:e�s�wZ����� S5O�j�9O�'4������ j�^W��� QR�`4VDo�v+P,=�j=�
�� v;.�'�������z
�Nx��*P��e�
C���@�� *r���mj�U}���
b?�<{���1A�@�i�Ұ+V�(�}���{��� PIG�I�
�w:/�o�]��
@�� 'sNN�� c◌ۤK�X�>v8 �L2,�μ�u����.�o��r�'ͪ���Q�]�R"��a���9
�i��
@-�V��� *���02�H#j'x����+�� O&��
�hw���o�,��j�X�� n �X��+(�D5�
�
�X8� 'J�L����� fP�G9�
����� n@����� k
�8�y3��H�a�� t���&�"I��)������ =��:��f#k#�G���+�Zx��^*�5�a7�� V�*V�/�}b�4J1@�[�� vb��� pM���
B|�;��YSA?^�� /Fj�
X8�H�� u�~G�����C/ c����� v��>�يcW�
`Q�
�$�$�B�^9C��;q�7P=�"/�x��ɡ$�ϴ�]\
��� J�0��� X=�R��J!�
ӗn<�� u�� waxs�1�qO0!Q�K�� 2gH|�x
�Z�Ɉ����� 2�.�=B,�� _�� �u������x]ň�8�� q����L����� Y4.$l�פ
!8�r�� w��� .T�
�Ū�������� gL�
�M��� kf�pN�b;��� &͎��
/��K��� iM���~j?�qM1���zɄ��n�?L����� }�ɤ�5��� U���T9q���X_�����^��_dGYf�V2�[
r^�� P�EbX�`�� S�#�
7K$T�q�L����
9�� �y]�p�'�^ �� d�w\m�
�� Eg�cC�� P�W�?�|KG���geȺ�bū���1epn[�� W�^�m�k
�� &��� (�N���� W <�v��� Y?w�#�Y$s���ש /˥�Y�� f�?8փ�� F>��ɽ��d�`( �g�BU����� _}��\�(� �� 2,�kD��j(�-
�z�g108�P�Bt��� N���I��H�2YPV�� w�����.p�Y��Yv��� 뎜�Ss?>�SS+!�� ~��� ^�+��p6|�w�� j*�)��� @G�r�����y8��VwG
P%#�H�F�w%*�E�?�^*3{�Q�S�n7?�&���o�
6│2�� ɛ@Y��� M�9�L�j�k�� T�D9 ���� �'�cwU�
Z�� 4]�*�� ʈ�Q�� -�kt�Z�� .Oɧ�ӛ�� ]v�8�SN|1`b�� -�(�
U�*�� :��� ��ڐ U0��dU�,�~MY�_�xh*���d�� ^�п�c�� ]å>͘+�ukG<�>WƹCE����� g1[�� ^䃉
�N68�s�� h�����UV\c������ Q^��i��������� <�Ժ��zǢ�� M_��� Ԛ�f��� t�� )������� })2���%du5�j��� BeMB�V�s,��
� ;�� )�&oDn��y�0�E���� M�7>�� "�� 9 �p;�vdK�?���� R½2�
�(^��e5D���>��H�������p��� )�
2�� <pEa�a�� gqd�o5�� 0 �G�� b�n<��u�v"��V��� H�� \������� [�
�%�B=���� Ԥ�`�+�FV�y jI_������� YK���Z˖�ά�M?gt�Z�g�϶Bu�;A�KQi�� VC�.�}���� U�r��x�� -�6�{ц
��� E�
�� ;�b�|jż�I�0Ľw�Ϩ������E�
�� F^-�dT�J+�
h�\�Fg=
�O�m:B��
@6F�y��OJR�%]�.v�;��!�[�� M�� 㑸�3� !\����B�lv[I�N0��� [O~�� <d��K��y?餃
�?]Yt�� Ψ<��g�� ]�u1ZD������PbK�� +GIafGKg@��
#���� j�� ^�[�� k�94�� +�2˳J�<U�ڶn��� w�� b�� 2�
���L`#>��� |��� ,G��Б�� `#�(%���q{�g\���ڍ 3 Y�� tV
Ah
�� -�v�� @A�
*�� 5������ڐ 2 }ԑƪe�3aj0!
�w$m��w6����+,5��;�B,�� ^��� '��4�;�yTPKZ��Z7jx��O�B)�@����� [6qR
am/!b�\:��ŧ�� ]��AJm"O5B�����~��� M��̃��� 4x�x�x�L�� 颕��� ^��� {��y�
+�� |1j�� /�c���d�q��z�� {�����
�g�� DJ;��b�� )_��
������
G�a�c�p◌ؑK�K��Nb�C�M=+!x_T��J���
1m�Ry�
�yd]�u
>wR�1h��SV"3���
;�&Z�� =�W�.���� e�w�� -��N��0W۳V�� j�� ���f+���� :/���p#c�n�� \ǠDz�G�q�
q���iK�F9�� r���E�Y�� %�i,��� J��� 9�'x�X���[◌ۜ�*�L5�{k�$a,̯]�t�TaEE˷.
�� L�w�� j�;ӵ��6◌ّ'%m��_;+BOƃ��� ,�Z��z{E�,��aSb�臞�� ,�� ]�� K�k&�� u_%��
�� c\8�JK��� j���� ?M
�c�U����������� #p��� ֊&fOI���
ÛG�� |����
)#wm��9}A9��;,�� ɚ�#O���~0�;ɬG)�x�������(�|�`�1���h�� V�D�8����
\�/!�Z-
8���+f�n#�k$����EJjZO�1��ps��b���u�}t��
pEB�zM��� <���
+�;S�� -��(cn��b��v,�
�)X���
�5ˌ8�=j4�
B ���
�8���B�p2�����p�� ��O&=�숫�l��u�� ,ץJP2z���1rz`���� Ȼ7�� [o�;4T�
�Ψ%�� ]-�BH�`6�,���� .�ĉ�ђz��K��1�v����
˻�R8<�� Y�í���4�Vo�?湿)�Ey�����/���ٶ
IXi��zT�J���
������� G�L���� Y����a0��N$��2[�� J
�i���);�'��
|�
�� %���+�~)�}j����� 2�ڗX|枚���� ]=;��6tun�,�-
N�� ,���6+n�iGF������t5��M��z���~1��$:KZ[�vd͙l���p{�M���ʛY���q5������I���IBvږANl l�� %$o?R���7(�m����
G�u-
QD�y����� VЎ|U9�B;�4 �� ڔ뱑�O�/Џ���� `�d+�)�h8d�ˉ�� -
�T�K�Ew�*�� ʩl��H�� Ճ�FS�t1E�w��q��\�� 4V���� q�j$��� BL��|̸֘�K�
�� 2P�őg�z�NW`#���� '�*���|�N
x���y�◌ۤ�� k6`?\R�q��a���q'��gk
�q6h�$X��� ^�u+S�? fc�� "�(Τp�����Yan�� A!P�<��H�
F�� {�'�Aq-n(;��#�� v�Td�f�� F�� A�NW�kO���� U뗶Pb�"��ykwǏ�Wz�ՏZo�l��C
�R�e.oÜ�� WDD��� Sƶ�� T��� G;m1PQ9g�j8����� ö�t����
ë�v�� W�tö�� Dä�� r���$��=��o�,w"�� !�D���/���éå#öo_5S/F����
��p�t�S ���xl���;�� 5�� j�&e��1,3
�#�e!6���� b4gN�� sZ�knq_�oQċ{��� L٭o�� ]��G��35�"f�� J�� I�,`��(��%0�� /\d�|-
���� |uL���=��ؗHy�� ǁ9�x���� U�$ӧŁ�Ɖ��N�M�� Gpѥ~�HN�<�B�|�b²���� A��������~��
@K�J\2k�_v�Q�4L0�� 3��#@�4l�r
�*�� 2�`��BJZ1 �� ���%��� *�l���Zl���� V��H�� Ǖ��6��� )�tFd �X�ԩ�� F4�wq��� W\����.���(�� ��+V�R|Â��D�f��
切�� '����� S�eS�PNp���@N���� 5l�� \h.̟�dp>�)�!r��� ɞr�� ��lx,x����
d�XA�+k4��D�;Y���B��NnlD����Ü�3kw�2�.�&����g�q獑��üwG<�"5��� U���&�.�.
��i����W1�kE��� 2b�WTh����?oq��N��V����� �͡��e�w�E͒@05���I�L����
u��t���� ux �� ����
,Z��
�ԁ�k��
눹Wԣ��
G��
#wö�
x�F+;�,��u�����
)t�/�c ��
*
é�K��r�M�8����qk��X�GT��"��i�'K_S뻕�� _F
��bs��R���V�3PNÄ��D�B�A,h�[�֡�j�u����a�
US����3R�v��<�I4��\�r�V��"��U$͖h��x.^\M����
R���E?Y��)��+�(��*�,���i�z����<y�/��
-
h��˜���I.I����
�mN��
u��o�ђ�����
=ow&
��b{���F(N���5�c��
ԥ��M��t(ö����ݵ
w���W)����
fv-���
*.e�q�tCBq=
L
C��9������hå���ãé���N��
4�"�+�� R�5ü
�ԑ�?]�9�`E�◌ٕ��7fiK�N���!��eض:鈝~F��U,�MQZ�ͤ
������ Jv�w�v5�^q�� {�������e�[,ַt5�y���� ,d�ˈ�2��F��� D Κd5n��sO�}��u��� }�f���h��f(��
r`
�� `��� :Vy>$i�Zx
�(�� /�oI)��� 3��t���l�W�*H~5�� :�(�JR���ف `�s�#*�Ë�� jq��� (��-
�� SW0C��� ԧ@�55�� ɠ�c�� @7�ü@1'I@�e5�O4�!�� cwHT9�#��� �� b6��8�(�6��A�å&Z���� ö���ü�
��� 2S��'�(a�x��B��aHE�� 0�<6�� ˻Ä��g�j�G�� Ü�Uc瘅
tjSW$äÜ����l�r>G⸒�>�+��M���� ?5w�Héo(ЋN��jW��� "�o�� EÄ�� *��I*N�_���&>�ä��+��� Ԫ��ZL�?��ZJ3�W�� é5&<���Kc
o�u������ثу0�Lp�.��RѵS�т�4����e��� Ș�� s�1m��� HO.<ֿHnzÄ�dÉ�_>�a����M�o8�c�� ä�A�A �F
�� M:m:K&�� *�'���I�"S9sN�ϙ?
&���� Ä���ü�K��� �=
��� ~�)�j�#}C�!P$r�t�
�� r��;h�XH-�� s_�V�]�I���I����U���$6�ok
�+ȼ5^E������ u�9�sT��/a�[��� n����[���� #�^�,�n�Uv�z0G��h16(��χf�W����� {��� Og��nd�e�E� f��=��i´":�<!�-
.�� 5WOy6�i3/��w��� r��� )�B<�?�6k��d�OM:z}�n;����� ^��� S�!Bй�
Fw�><����\��� b\�"���
O�qW�� \���
z~r_?pcr�B�=�"�N�͝*Y$D�� Nl|$��
}�-
/9K�� .&Zh+�
X�ԲF�qSI��H98�c�&��V�u�kU<
s�G��a�jL������ :�� ]�� \�A�
Z��� E��� c�r�)��e�s��n�� *��<
ϘKx�d�
*******************************************************************************************
Encrypt the symmetric key information with Bob's public key
1��|qz%(����^ieGԓ
��� J,�� ~�Y�T�0I���� 4�i��\����q�� -4i�>D��tR�;_�W�� oJ����
D�r�� .����h�G\�m�� C��������� Zj���� O
*******************************************************************************************
Package the DES3 encrypted digest package and RSA encrypted Symmetric key in a tarball.
*******************************************************************************************
Sending package:
Sending encrypted_message_package.tar(20480 bytes)
*******************************************************************************************
[andrewe@lab1-10 alice]$