aboutsummaryrefslogtreecommitdiff
path: root/openssl/demos/maurice/example2.c
diff options
context:
space:
mode:
authorMike DePaulo <mikedep333@gmail.com>2014-09-01 17:44:28 -0400
committerMike DePaulo <mikedep333@gmail.com>2014-09-01 17:44:28 -0400
commitf13663bcc1a0d7b86a29e52e0a0d5bd746bc4d21 (patch)
treefd03f01d13342419f0ebaf53daa0161a072a8d62 /openssl/demos/maurice/example2.c
parentcf84b2dc07ef59c1adb4fe29789c7dbbbd35fbb4 (diff)
downloadvcxsrv-f13663bcc1a0d7b86a29e52e0a0d5bd746bc4d21.tar.gz
vcxsrv-f13663bcc1a0d7b86a29e52e0a0d5bd746bc4d21.tar.bz2
vcxsrv-f13663bcc1a0d7b86a29e52e0a0d5bd746bc4d21.zip
Update OpenSSL from 1.0.1h to 1.0.1i
Diffstat (limited to 'openssl/demos/maurice/example2.c')
-rw-r--r--openssl/demos/maurice/example2.c75
1 files changed, 0 insertions, 75 deletions
diff --git a/openssl/demos/maurice/example2.c b/openssl/demos/maurice/example2.c
deleted file mode 100644
index 57bce10b5..000000000
--- a/openssl/demos/maurice/example2.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* NOCW */
-/*
- Please read the README file for condition of use, before
- using this software.
-
- Maurice Gittens <mgittens@gits.nl> January 1997
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <strings.h>
-
-#include <openssl/rsa.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#include <openssl/x509.h>
-#include <openssl/err.h>
-#include <openssl/pem.h>
-#include <openssl/ssl.h>
-
-#include "loadkeys.h"
-
-#define PUBFILE "cert.pem"
-#define PRIVFILE "privkey.pem"
-#define STDIN 0
-#define STDOUT 1
-
-int main()
-{
- char *ct = "This the clear text";
- char *buf;
- char *buf2;
- EVP_PKEY *pubKey;
- EVP_PKEY *privKey;
- int len;
-
- ERR_load_crypto_strings();
-
- privKey = ReadPrivateKey(PRIVFILE);
- if (!privKey)
- {
- ERR_print_errors_fp (stderr);
- exit (1);
- }
-
- pubKey = ReadPublicKey(PUBFILE);
- if(!pubKey)
- {
- EVP_PKEY_free(privKey);
- fprintf(stderr,"Error: can't load public key");
- exit(1);
- }
-
- /* No error checking */
- buf = malloc(EVP_PKEY_size(pubKey));
- buf2 = malloc(EVP_PKEY_size(pubKey));
-
- len = RSA_public_encrypt(strlen(ct)+1, ct, buf, pubKey->pkey.rsa,RSA_PKCS1_PADDING);
-
- if (len != EVP_PKEY_size(pubKey))
- {
- fprintf(stderr,"Error: ciphertext should match length of key\n");
- exit(1);
- }
-
- RSA_private_decrypt(len, buf, buf2, privKey->pkey.rsa,RSA_PKCS1_PADDING);
-
- printf("%s\n", buf2);
-
- EVP_PKEY_free(privKey);
- EVP_PKEY_free(pubKey);
- free(buf);
- free(buf2);
- return 0;
-}