Skip to content

Instantly share code, notes, and snippets.

@Grrrben
Last active November 1, 2018 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grrrben/5de0b636c6de138555209292407d5136 to your computer and use it in GitHub Desktop.
Save Grrrben/5de0b636c6de138555209292407d5136 to your computer and use it in GitHub Desktop.
func TestPublicKeyExample(t *testing.T) {
henk, _ := NewRsaIdentity()
ingrid, _ := NewRsaIdentity()
msg := []byte("Negenennegentig procent van de problemen in de wereld worden veroorzaakt door buitenlanders.")
// Lets encrypt it, we want to sent it to Ingrid, thus, we use her public key.
encryptedMessage, _ := henk.Encrypt(msg, ingrid.public)
fmt.Printf("%s\n", msg)
// Negenennegentig procent van de problemen in de wereld worden veroorzaakt door buitenlanders. �zmNOOe@{��}9������#-��^� ����Jh��l0����c2S���a>�AA/�z�2��*c�@^w�P�Xu�HK���hu_u̴Jsi���7
fmt.Printf("%s\n", encryptedMessage)
// zmNOOe@{��}9������#-��^� ����Jh��l0����c2S���a>�AA/�z�2��*c�@^w�P�Xu�HK���hu_u̴Jsi���7
// �w�n��Z,2��w��a���W*G3��'ZR�
// *�4�␤�� ��Q�M
// Ԓ┴L�H[)�@␤�≥���������>�⎽��VW�≥#��/P%�C���F
// ���@��F·┴�C�%�OҎ�≤B���◆8�@�┴EL��� ��������J─
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment