summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2021-08-11 11:12:17 +1000
committerMatt Caswell <matt@openssl.org>2021-11-16 15:58:23 +0000
commit35530b117fcf54cf733c485e9e2e267963c081ee (patch)
tree5b02e5976bcd4a29733b99abf2880d0640780d22 /demos
parent3066cf2614d22182ae0dafd4557a96ab6b698d4f (diff)
Add RSA encrypt demo
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16283)
Diffstat (limited to 'demos')
-rw-r--r--demos/README.txt3
-rw-r--r--demos/encrypt/Makefile20
-rw-r--r--demos/encrypt/rsa_encrypt.c243
-rw-r--r--demos/encrypt/rsa_encrypt.h141
4 files changed, 407 insertions, 0 deletions
diff --git a/demos/README.txt b/demos/README.txt
index 291094bf9d..4f1e9dacc6 100644
--- a/demos/README.txt
+++ b/demos/README.txt
@@ -18,6 +18,9 @@ EVP_MD_demo.c Compute a digest from multiple buffers
EVP_MD_stdin.c Compute a digest with data read from stdin
EVP_f_md.c Compute a digest using BIO and EVP_f_md
+encrypt:
+rsa_encrypt.c Encrypt and decrypt data using an RSA keypair.
+
kdf:
hkdf.c Demonstration of HMAC based key derivation
pbkdf2.c Demonstration of PBKDF2 password based key derivation
diff --git a/demos/encrypt/Makefile b/demos/encrypt/Makefile
new file mode 100644
index 0000000000..1735640b3f
--- /dev/null
+++ b/demos/encrypt/Makefile
@@ -0,0 +1,20 @@
+#
+# To run the demos when linked with a shared library (default):
+#
+# LD_LIBRARY_PATH=../.. ./rsa_encrypt
+
+CFLAGS = -I../../include -g
+LDFLAGS = -L../..
+LDLIBS = -lcrypto
+
+all: rsa_encrypt
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $<
+
+rsa_encrypt_ec: rsa_encrypt.o
+
+test: ;
+
+clean:
+ $(RM) *.o rsa_encrypt
diff --git a/demos/encrypt/rsa_encrypt.c b/demos/encrypt/rsa_encrypt.c
new file mode 100644
index 0000000000..e3d8981e41
--- /dev/null
+++ b/demos/encrypt/rsa_encrypt.c
@@ -0,0 +1,243 @@
+/*-
+ * Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*
+ * An example that uses EVP_PKEY_encrypt and EVP_PKEY_decrypt methods
+ * to encrypt and decrypt data using an RSA keypair.
+ * RSA encryption produces different encrypted output each time it is run,
+ * hence this is not a known answer test.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <openssl/err.h>
+#include <openssl/evp.h>
+#include <openssl/decoder.h>
+#include <openssl/core_names.h>
+#include "rsa_encrypt.h"
+
+/* Input data to encrypt */
+static const unsigned char msg[] =
+ "To be, or not to be, that is the question,\n"
+ "Whether tis nobler in the minde to suffer\n"
+ "The slings and arrowes of outragious fortune,\n"
+ "Or to take Armes again in a sea of troubles";
+
+/*
+ * For do_encrypt(), load an RSA public key from pub_key_der[].
+ * For do_decrypt(), load an RSA private key from priv_key_der[].
+ */
+static EVP_PKEY *get_key(OSSL_LIB_CTX *libctx, const char *propq, int public)
+{
+ OSSL_DECODER_CTX *dctx = NULL;
+ EVP_PKEY *pkey = NULL;
+ int selection;
+ const unsigned char *data;
+ size_t data_len;
+
+ if (public) {
+ selection = EVP_PKEY_PUBLIC_KEY;
+ data = pub_key_der;
+ data_len = sizeof(pub_key_der);
+ } else {
+ selection = EVP_PKEY_KEYPAIR;
+ data = priv_key_der;
+ data_len = sizeof(priv_key_der);
+ }
+ dctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, "DER", NULL, "RSA",
+ selection, libctx, propq);
+ (void)OSSL_DECODER_from_data(dctx, &data, &data_len);
+ OSSL_DECODER_CTX_free(dctx);
+ return pkey;
+}
+
+/* Set optional parameters for RSA OAEP Padding */
+static void set_optional_params(OSSL_PARAM *p, const char *propq)
+{
+ static unsigned char label[] = "label";
+
+ /* "pkcs1" is used by default if the padding mode is not set */
+ *p++ = OSSL_PARAM_construct_utf8_string(OSSL_ASYM_CIPHER_PARAM_PAD_MODE,
+ OSSL_PKEY_RSA_PAD_MODE_OAEP, 0);
+ /* No oaep_label is used if this is not set */
+ *p++ = OSSL_PARAM_construct_octet_string(OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL,
+ label, sizeof(label));
+ /* "SHA1" is used if this is not set */
+ *p++ = OSSL_PARAM_construct_utf8_string(OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST,
+ "SHA256", 0);
+ /*
+ * If a non default property query needs to be specified when fetching the
+ * OAEP digest then it needs to be specified here.
+ */
+ if (propq != NULL)
+ *p++ = OSSL_PARAM_construct_utf8_string(OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS,
+ (char *)propq, 0);
+
+ /*
+ * OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST and
+ * OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS can also be optionally added
+ * here if the MGF1 digest differs from the OAEP digest.
+ */
+
+ *p = OSSL_PARAM_construct_end();
+}
+
+/*
+ * The length of the input data that can be encrypted is limited by the
+ * RSA key length minus some additional bytes that depends on the padding mode.
+ *
+ */
+static int do_encrypt(OSSL_LIB_CTX *libctx,
+ const unsigned char *in, size_t in_len,
+ unsigned char **out, size_t *out_len)
+{
+ int ret = 0, public = 1;
+ size_t buf_len = 0;
+ unsigned char *buf = NULL;
+ const char *propq = NULL;
+ EVP_PKEY_CTX *ctx = NULL;
+ EVP_PKEY *pub_key = NULL;
+ OSSL_PARAM params[5];
+
+ /* Get public key */
+ pub_key = get_key(libctx, propq, public);
+ if (pub_key == NULL) {
+ fprintf(stderr, "Get public key failed.\n");
+ goto cleanup;
+ }
+ ctx = EVP_PKEY_CTX_new_from_pkey(libctx, pub_key, propq);
+ if (ctx == NULL) {
+ fprintf(stderr, "EVP_PKEY_CTX_new_from_pkey() failed.\n");
+ goto cleanup;
+ }
+ set_optional_params(params, propq);
+ /* If no optional parameters are required then NULL can be passed */
+ if (EVP_PKEY_encrypt_init_ex(ctx, params) <= 0) {
+ fprintf(stderr, "EVP_PKEY_encrypt_init_ex() failed.\n");
+ goto cleanup;
+ }
+ /* Calculate the size required to hold the encrypted data */
+ if (EVP_PKEY_encrypt(ctx, NULL, &buf_len, in, in_len) <= 0) {
+ fprintf(stderr, "EVP_PKEY_encrypt() failed.\n");
+ goto cleanup;
+ }
+ buf = OPENSSL_zalloc(buf_len);
+ if (buf == NULL) {
+ fprintf(stderr, "Malloc failed.\n");
+ goto cleanup;
+ }
+ if (EVP_PKEY_encrypt(ctx, buf, &buf_len, in, in_len) <= 0) {
+ fprintf(stderr, "EVP_PKEY_encrypt() failed.\n");
+ goto cleanup;
+ }
+ *out_len = buf_len;
+ *out = buf;
+ fprintf(stdout, "Encrypted:\n");
+ BIO_dump_indent_fp(stdout, buf, buf_len, 2);
+ fprintf(stdout, "\n");
+ ret = 1;
+
+cleanup:
+ if (!ret)
+ OPENSSL_free(buf);
+ EVP_PKEY_free(pub_key);
+ EVP_PKEY_CTX_free(ctx);
+ return ret;
+}
+
+static int do_decrypt(OSSL_LIB_CTX *libctx, const char *in, size_t in_len,
+ unsigned char **out, size_t *out_len)
+{
+ int ret = 0, public = 0;
+ size_t buf_len = 0;
+ unsigned char *buf = NULL;
+ const char *propq = NULL;
+ EVP_PKEY_CTX *ctx = NULL;
+ EVP_PKEY *priv_key = NULL;
+ OSSL_PARAM params[5];
+
+ /* Get private key */
+ priv_key = get_key(libctx, propq, public);
+ if (priv_key == NULL) {
+ fprintf(stderr, "Get private key failed.\n");
+ goto cleanup;
+ }
+ ctx = EVP_PKEY_CTX_new_from_pkey(libctx, priv_key, propq);
+ if (ctx == NULL) {
+ fprintf(stderr, "EVP_PKEY_CTX_new_from_pkey() failed.\n");
+ goto cleanup;
+ }
+
+ /* The parameters used for encryption must also be used for decryption */
+ set_optional_params(params, propq);
+ /* If no optional parameters are required then NULL can be passed */
+ if (EVP_PKEY_decrypt_init_ex(ctx, params) <= 0) {
+ fprintf(stderr, "EVP_PKEY_decrypt_init_ex() failed.\n");
+ goto cleanup;
+ }
+ /* Calculate the size required to hold the decrypted data */
+ if (EVP_PKEY_decrypt(ctx, NULL, &buf_len, in, in_len) <= 0) {
+ fprintf(stderr, "EVP_PKEY_decrypt() failed.\n");
+ goto cleanup;
+ }
+ buf = OPENSSL_zalloc(buf_len);
+ if (buf == NULL) {
+ fprintf(stderr, "Malloc failed.\n");
+ goto cleanup;
+ }
+ if (EVP_PKEY_decrypt(ctx, buf, &buf_len, in, in_len) <= 0) {
+ fprintf(stderr, "EVP_PKEY_decrypt() failed.\n");
+ goto cleanup;
+ }
+ *out_len = buf_len;
+ *out = buf;
+ fprintf(stdout, "Decrypted:\n");
+ BIO_dump_indent_fp(stdout, buf, buf_len, 2);
+ fprintf(stdout, "\n");
+ ret = 1;
+
+cleanup:
+ if (!ret)
+ OPENSSL_free(buf);
+ EVP_PKEY_free(priv_key);
+ EVP_PKEY_CTX_free(ctx);
+ return ret;
+}
+
+int main(void)
+{
+ int ret = EXIT_FAILURE;
+ size_t msg_len = sizeof(msg) - 1;
+ size_t encrypted_len = 0, decrypted_len = 0;
+ unsigned char *encrypted = NULL, *decrypted = NULL;
+ OSSL_LIB_CTX *libctx = NULL;
+
+ if (!do_encrypt(libctx, msg, msg_len, &encrypted, &encrypted_len)) {
+ fprintf(stderr, "encryption failed.\n");
+ goto cleanup;
+ }
+ if (!do_decrypt(libctx, encrypted, encrypted_len,
+ &decrypted, &decrypted_len)) {
+ fprintf(stderr, "decryption failed.\n");
+ goto cleanup;
+ }
+ if (CRYPTO_memcmp(msg, decrypted, decrypted_len) != 0) {
+ fprintf(stderr, "Decrypted data does not match expected value\n");
+ goto cleanup;
+ }
+ ret = EXIT_SUCCESS;
+
+cleanup:
+ OPENSSL_free(decrypted);
+ OPENSSL_free(encrypted);
+ OSSL_LIB_CTX_free(libctx);
+ if (ret != EXIT_SUCCESS)
+ ERR_print_errors_fp(stderr);
+ return ret;
+}
diff --git a/demos/encrypt/rsa_encrypt.h b/demos/encrypt/rsa_encrypt.h
new file mode 100644
index 0000000000..8cb29391b2
--- /dev/null
+++ b/demos/encrypt/rsa_encrypt.h
@@ -0,0 +1,141 @@
+/*-
+ * Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/* Private RSA key used for decryption */
+static const unsigned char priv_key_der[] = {
+ 0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,
+ 0xc2, 0x44, 0xbc, 0xcf, 0x5b, 0xca, 0xcd, 0x80, 0x77, 0xae, 0xf9, 0x7a,
+ 0x34, 0xbb, 0x37, 0x6f, 0x5c, 0x76, 0x4c, 0xe4, 0xbb, 0x0c, 0x1d, 0xe7,
+ 0xfe, 0x0f, 0xda, 0xcf, 0x8c, 0x56, 0x65, 0x72, 0x6e, 0x2c, 0xf9, 0xfd,
+ 0x87, 0x43, 0xeb, 0x4c, 0x26, 0xb1, 0xd3, 0xf0, 0x87, 0xb1, 0x18, 0x68,
+ 0x14, 0x7d, 0x3c, 0x2a, 0xfa, 0xc2, 0x5d, 0x70, 0x19, 0x11, 0x00, 0x2e,
+ 0xb3, 0x9c, 0x8e, 0x38, 0x08, 0xbe, 0xe3, 0xeb, 0x7d, 0x6e, 0xc7, 0x19,
+ 0xc6, 0x7f, 0x59, 0x48, 0x84, 0x1b, 0xe3, 0x27, 0x30, 0x46, 0x30, 0xd3,
+ 0xfc, 0xfc, 0xb3, 0x35, 0x75, 0xc4, 0x31, 0x1a, 0xc0, 0xc2, 0x4c, 0x0b,
+ 0xc7, 0x01, 0x95, 0xb2, 0xdc, 0x17, 0x77, 0x9b, 0x09, 0x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 0xed, 0x8d, 0x2a, 0x15, 0x77, 0x1d, 0x53, 0x47, 0xe0, 0xa2, 0x11,
+ 0x41, 0x0d, 0xe2, 0xe7,
+};
+
+/* The matching public key used for encryption*/
+static const unsigned char pub_key_der[] = {
+ 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
+ 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00,
+ 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc2, 0x44, 0xbc,
+ 0xcf, 0x5b, 0xca, 0xcd, 0x80, 0x77, 0xae, 0xf9, 0x7a, 0x34, 0xbb, 0x37,
+ 0x6f, 0x5c, 0x76, 0x4c, 0xe4, 0xbb, 0x0c, 0x1d, 0xe7, 0xfe, 0x0f, 0xda,
+ 0xcf, 0x8c, 0x56, 0x65, 0x72, 0x6e, 0x2c, 0xf9, 0xfd, 0x87, 0x43, 0xeb,
+ 0x4c, 0x26, 0xb1, 0xd3, 0xf0, 0x87, 0xb1, 0x18, 0x68, 0x14, 0x7d, 0x3c,
+ 0x2a, 0xfa, 0xc2, 0x5d, 0x70, 0x19, 0x11, 0x00, 0x2e, 0xb3, 0x9c, 0x8e,
+ 0x38, 0x08, 0xbe, 0xe3, 0xeb, 0x7d, 0x6e, 0xc7, 0x19, 0xc6, 0x7f, 0x59,
+ 0x48, 0x84, 0x1b, 0xe3, 0x27, 0x30, 0x46, 0x30, 0xd3, 0xfc, 0xfc, 0xb3,
+ 0x35, 0x75, 0xc4, 0x31, 0x1a, 0xc0, 0xc2, 0x4c, 0x0b, 0xc7, 0x01, 0x95,
+ 0xb2, 0xdc, 0x17, 0x77, 0x9b, 0x09, 0x15, 0x04, 0xbc, 0xdb, 0x57, 0x0b,
+ 0x26, 0xda, 0x59, 0x54, 0x0d, 0x6e, 0xb7, 0x89, 0xbc, 0x53, 0x9d, 0x5f,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