From e1b05e3a6cd90b0bf91b47aeff71da2a9d048a9d Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Tue, 8 Oct 2002 05:39:08 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'RELENG_4_7_0_RELEASE'. This commit was manufactured to restore the state of the 4.7-RELEASE image. Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs. --- crypto/openssl/demos/maurice/example2.c | 75 --------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 crypto/openssl/demos/maurice/example2.c (limited to 'crypto/openssl/demos/maurice/example2.c') diff --git a/crypto/openssl/demos/maurice/example2.c b/crypto/openssl/demos/maurice/example2.c deleted file mode 100644 index 57bce10b5ed5..000000000000 --- a/crypto/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 January 1997 -*/ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#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; -} -- cgit v1.2.3