You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In yubikey 0.7, Certificate::generate_self_signed took a yubikey::certificate::PublicKeyInfo argument as the key to generate the certificate for. This was an enum that was obtained from yubikey::piv::generate after passing in an AlgorithmId enum, so algorithm information was inherently passed from one to the other.
In yubikey 0.8, yubikey::piv::generate and Certificate::generate_self_signed now communicate via a SubjectPublicKeyInfoOwned, which is an opaque type. As a side-effect, Certificate::generate_self_signed now requires a type argument to work. Failing to set the type argument causes obscure and confusing errors related to the extensions closure.
However, yubikey::piv::generate still takes an AlgorithmId enum. So the algorithm of the SubjectPublicKeyInfoOwned that yubikey::piv::generate returns may be determined at runtime, and yet Certificate::generate_self_signed requires it to be fixed at compile time. This is a confusing API, as to correctly handle runtime determination you need to embed four copies of Certificate::generate_self_signed.
We should either have the API use a runtime-specified or compile-time-specified algorithm, not both.
If we go with compile-time, yubikey::piv::generate should not return an opaque SubjectPublicKeyInfoOwned, but instead a type that carries the compile-time algorithm with it for Certificate::generate_self_signed to use.
The text was updated successfully, but these errors were encountered:
In
yubikey 0.7
,Certificate::generate_self_signed
took ayubikey::certificate::PublicKeyInfo
argument as the key to generate the certificate for. This was an enum that was obtained fromyubikey::piv::generate
after passing in anAlgorithmId
enum, so algorithm information was inherently passed from one to the other.In
yubikey 0.8
,yubikey::piv::generate
andCertificate::generate_self_signed
now communicate via aSubjectPublicKeyInfoOwned
, which is an opaque type. As a side-effect,Certificate::generate_self_signed
now requires a type argument to work. Failing to set the type argument causes obscure and confusing errors related to theextensions
closure.However,
yubikey::piv::generate
still takes anAlgorithmId
enum. So the algorithm of theSubjectPublicKeyInfoOwned
thatyubikey::piv::generate
returns may be determined at runtime, and yetCertificate::generate_self_signed
requires it to be fixed at compile time. This is a confusing API, as to correctly handle runtime determination you need to embed four copies ofCertificate::generate_self_signed
.yubikey::piv::generate
should not return an opaqueSubjectPublicKeyInfoOwned
, but instead a type that carries the compile-time algorithm with it forCertificate::generate_self_signed
to use.The text was updated successfully, but these errors were encountered: