forked from openssl/openssl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
180 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
=pod | ||
|
||
=head1 NAME | ||
|
||
EVP_SKEY_import, EVP_SKEY_export | ||
- functions to create opaque symmetric keys from user data and export keydata | ||
|
||
=head1 SYNOPSIS | ||
|
||
#include <openssl/evp.h> | ||
|
||
int EVP_SKEY_import(EVP_SKEY *skey, const OSSL_PARAM *params); | ||
int EVP_SKEY_export(const EVP_SKEY *skey, int selection, | ||
OSSL_CALLBACK *export_cb, void *export_cbarg); | ||
|
||
=head1 DESCRIPTION | ||
|
||
The functions described here are used to create new keys from user | ||
provided key data, such as I<n>, I<e> and I<d> for a minimal RSA | ||
keypair. | ||
|
||
EVP_SKEY_import() creates the structure to store a key to a B<EVP_SKEY> object | ||
created by EVP_SKEY_new() The exact key data that the user can pass depends on | ||
the key type and the provider in use. These are passed as an L<OSSL_PARAM(3)> | ||
array. | ||
|
||
Parameters in the I<params> array that are not among the settable parameters | ||
for the given I<selection> are ignored. | ||
|
||
EVP_SKEY_export() extracts values from a key I<skey> using the I<selection>. | ||
I<selection> is described below. It uses a callback | ||
I<export_cb> that gets passed the value of I<export_cbarg>. | ||
See L<openssl-core.h(7)> for more information about the callback. Note that the | ||
L<OSSL_PARAM(3)> array that is passed to the callback is not persistent after the | ||
callback returns. | ||
|
||
L<OSSL_PARAM_free(3)> should be used to free the returned parameters in | ||
I<*params>. | ||
|
||
=head2 Selections | ||
|
||
The following constants can be used for I<selection>: | ||
|
||
=over 4 | ||
|
||
=item B<OSSL_KEYMGMT_SELECT_SECRET_KEY> | ||
|
||
Only raw key representation will be selected. | ||
|
||
=item B<OSSL_KEYMGMT_SELECT_ALL_PARAMETERS> | ||
|
||
Only key parameters will be selected. This includes optional key | ||
parameters. | ||
|
||
=item B<OSSL_KEYMGMT_SELECT_ALL> | ||
|
||
All parameters will be selected. | ||
|
||
=back | ||
|
||
=head1 RETURN VALUES | ||
|
||
EVP_SKEY_import() and EVP_SKEY_export() return 1 for success and 0 for failure. | ||
|
||
=head1 SEE ALSO | ||
|
||
L<EVP_SKEY_new(3)>, L<provider(7)>, L<OSSL_PARAM(3)> | ||
|
||
=head1 HISTORY | ||
|
||
These functions were added in OpenSSL 3.5. | ||
|
||
=head1 COPYRIGHT | ||
|
||
Copyright 2024 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 | ||
L<https://www.openssl.org/source/license.html>. | ||
|
||
=cut | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
=pod | ||
|
||
=head1 NAME | ||
|
||
EVP_SKEY, | ||
EVP_SKEY_new, | ||
EVP_SKEY_up_ref, | ||
EVP_SKEY_free | ||
- opaque symmetric key allocation and handling functions | ||
|
||
=head1 SYNOPSIS | ||
|
||
#include <openssl/evp.h> | ||
|
||
typedef evp_skey_st EVP_SKEY; | ||
|
||
EVP_SKEY *EVP_SKEY_new(void); | ||
int EVP_SKEY_up_ref(EVP_SKEY *key); | ||
void EVP_SKEY_free(EVP_SKEY *key); | ||
|
||
=head1 DESCRIPTION | ||
|
||
B<EVP_SKEY> is a generic structure to hold symmetric keys as opaque objects. | ||
The keys themselves are often referred to as the "internal key", and are handled by | ||
providers through L<EVP_KEYMGMT(3)>. | ||
|
||
Conceptually, an B<EVP_SKEY> internal key may hold a symmetric key, and along | ||
with those, key parameters if the key type requires them. | ||
|
||
The EVP_SKEY_new() function allocates an empty B<EVP_SKEY> structure which is | ||
used by OpenSSL to store public and private keys. The reference count is set to | ||
B<1>. | ||
|
||
EVP_SKEY_up_ref() increments the reference count of I<key>. | ||
|
||
EVP_SKEY_free() decrements the reference count of I<key> and, if the reference | ||
count is zero, frees it up. If I<key> is NULL, nothing is done. | ||
|
||
=head1 NOTES | ||
|
||
The B<EVP_SKEY> structure is used by various OpenSSL functions which require a | ||
general symmetric key without reference to any particular algorithm. | ||
|
||
=head1 RETURN VALUES | ||
|
||
EVP_SKEY_new() returns either the newly | ||
allocated B<EVP_SKEY> structure or NULL if an error occurred. | ||
|
||
EVP_SKEY_up_ref() returns 1 for success and 0 for failure. | ||
|
||
=head1 HISTORY | ||
|
||
The B<EVP_SKEY> API was introduced in OpenSSL 3.5. | ||
|
||
=head1 COPYRIGHT | ||
|
||
Copyright 2024 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 | ||
L<https://www.openssl.org/source/license.html>. | ||
|
||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters