provider-object.pod 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. =pod
  2. =head1 NAME
  3. provider-object - A specification for a provider-native object abstraction
  4. =head1 SYNOPSIS
  5. =for openssl multiple includes
  6. #include <openssl/core_object.h>
  7. #include <openssl/core_names.h>
  8. =head1 DESCRIPTION
  9. The provider-native object abstraction is a set of L<OSSL_PARAM(3)> keys and
  10. values that can be used to pass provider-native objects to OpenSSL library
  11. code or between different provider operation implementations with the help
  12. of OpenSSL library code.
  13. The intention is that certain provider-native operations can pass any sort
  14. of object that belong with other operations, or with OpenSSL library code.
  15. An object may be passed in the following manners:
  16. =over 4
  17. =item 1.
  18. I<By value>
  19. This means that the I<object data> is passed as an octet string or an UTF8
  20. string, which can be handled in diverse ways by other provided implementations.
  21. The encoding of the object depends on the context it's used in; for example,
  22. L<OSSL_DECODER(3)> allows multiple encodings, depending on existing decoders.
  23. If central OpenSSL library functionality is to handle the data directly, it
  24. B<must> be encoded in DER for all object types except for B<OSSL_OBJECT_NAME>
  25. (see L</Parameter reference> below), where it's assumed to a plain UTF8 string.
  26. =for comment A future extension might be to be able to specify encoding as a
  27. separate parameter.
  28. =item 2.
  29. I<By reference>
  30. This means that the I<object data> isn't passed directly, an I<object
  31. reference> is passed instead. It's an octet string that only the correct
  32. provider understands correctly.
  33. =back
  34. Objects I<by value> can be used by anything that handles DER encoded
  35. objects.
  36. Objects I<by reference> need a higher level of cooperation from the
  37. implementation where the object originated (let's call it X) and its target
  38. implementation (let's call it Y):
  39. =over 4
  40. =item 1.
  41. I<An object loading function in the target implementation>
  42. The target implementation (Y) may have a function that can take an I<object
  43. reference>. This can only be used if the target implementation is from the
  44. same provider as the one originating the object abstraction in question (X).
  45. The exact target implementation to use is determined from the I<object type>
  46. and possibly the I<object data type>.
  47. For example, when the OpenSSL library receives an object abstraction with the
  48. I<object type> B<OSSL_OBJECT_PKEY>, it will fetch a L<provider-keymgmt(7)>
  49. using the I<object data type> as its key type (the second argument in
  50. L<EVP_KEYMGMT_fetch(3)>).
  51. =item 2.
  52. I<An object exporter in the originating implementation>
  53. The originating implementation (X) may have an exporter function. This
  54. exporter function can be used to export the object in L<OSSL_PARAM(3)> form,
  55. that can then be imported by the target implementation's imported function.
  56. This can be used when it's not possible to fetch the target implementation
  57. (Y) from the same provider.
  58. =back
  59. =head2 Parameter reference
  60. A provider-native object abstraction is an L<OSSL_PARAM(3)> with a selection
  61. of the following parameters:
  62. =over 4
  63. =item "data" (B<OSSL_OBJECT_PARAM_DATA>) <octet string> or <utf8 string>
  64. The object data I<passed by value>.
  65. =item "reference" (B<OSSL_OBJECT_PARAM_REFERENCE>) <octet string>
  66. The object data I<passed by reference>.
  67. =item "type" (B<OSSL_OBJECT_PARAM_TYPE>) <integer>
  68. The I<object type>, a number that may have any of the following values (all
  69. defined in F<< <openssl/core_object.h> >>):
  70. =over 4
  71. =item B<OSSL_OBJECT_NAME>
  72. The object data may only be I<passed by value>, and should be a UTF8
  73. string.
  74. This is useful for L<provider-storemgmt(7)> when a URI load results in new
  75. URIs.
  76. =item B<OSSL_OBJECT_PKEY>
  77. The object data is suitable as provider-native B<EVP_PKEY> key data. The
  78. object data may be I<passed by value> or I<passed by reference>.
  79. =item B<OSSL_OBJECT_CERT>
  80. The object data is suitable as B<X509> data. The object data for this
  81. object type can only be I<passed by value>, and should be an octet string.
  82. Since there's no provider-native X.509 object, OpenSSL libraries that
  83. receive this object abstraction are expected to convert the data to a
  84. B<X509> object with d2i_X509().
  85. =item B<OSSL_OBJECT_CRL>
  86. The object data is suitable as B<X509_CRL> data. The object data can
  87. only be I<passed by value>, and should be an octet string.
  88. Since there's no provider-native X.509 CRL object, OpenSSL libraries that
  89. receive this object abstraction are expected to convert the data to a
  90. B<X509_CRL> object with d2i_X509_CRL().
  91. =back
  92. =item "data-type" (B<OSSL_OBJECT_PARAM_DATA_TYPE>) <utf8 string>
  93. The specific type of the object content. Legitimate values depend on the
  94. object type; if it is B<OSSL_OBJECT_PKEY>, the data type is expected to be a
  95. key type suitable for fetching a L<provider-keymgmt(7)> that can handle the
  96. data.
  97. =for comment For objects with an unknown object type (OSSL_OBJECT_PARAM_TYPE
  98. is either missing or has the value OSSL_OBJECT_UNKNOWN), libcrypto
  99. interprets the object data type as the input type for a decoder.
  100. =item "data-structure" (B<OSSL_OBJECT_PARAM_DATA_STRUCTURE>) <utf8 string>
  101. The outermost structure of the object content. Legitimate values depend on
  102. the object type.
  103. =item "desc" (B<OSSL_OBJECT_PARAM_DESC>) <utf8 string>
  104. A human readable text that describes extra details on the object.
  105. =back
  106. When a provider-native object abtraction is used, it I<must> contain object
  107. data in at least one form (object data I<passed by value>, i.e. the "data"
  108. item, or object data I<passed by reference>, i.e. the "reference" item).
  109. Both may be present at once, in which case the OpenSSL library code that
  110. receives this will use the most optimal variant.
  111. For objects with the object type B<OSSL_OBJECT_NAME>, that object type
  112. I<must> be given.
  113. =head1 SEE ALSO
  114. L<provider(7)>, L<OSSL_DECODER(3)>
  115. =head1 HISTORY
  116. The concept of providers and everything surrounding them was
  117. introduced in OpenSSL 3.0.
  118. =head1 COPYRIGHT
  119. Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  120. Licensed under the Apache License 2.0 (the "License"). You may not use
  121. this file except in compliance with the License. You can obtain a copy
  122. in the file LICENSE in the source distribution or at
  123. L<https://www.openssl.org/source/license.html>.
  124. =cut