[gnutls-devel] GnuTLS | x509: pin/password callback support for openssl encrypted private keys (!1459)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Sat Aug 14 08:37:00 CEST 2021




Daiki Ueno started a new discussion on lib/x509/privkey.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1459#note_651137502

>  		    /* use the callback if any */
>  			ret = _gnutls_retrieve_pin(&key->pin, "key:", "", 0, pin, sizeof(pin));
>  			if (ret == 0) {
> -				password = pin;
> +				ret = gnutls_x509_privkey_import_pkcs8(key, data, format, pin, flags);
>  			}
> -
> -			ret =
> -			    gnutls_x509_privkey_import_pkcs8(key, data, format,
> -						     password, flags);

Sorry for the oversight during the review, but this change seems to modify the existing behavior, which is to use the provided `password` as PIN when `_gnutls_retrieve_pin` returns an error (either because no PIN callback is set or it reports error). So I suppose this part should be:
```c
ret = _gnutls_retrieve_pin(...);
if (ret == 0) {
  ret = gnutls_x509_privkey_import_pkcs8(..., pin, ...);
} else {
  ret = gnutls_x509_privkey_import_pkcs8(..., password, ...);
}
```

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1459#note_651137502
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20210814/0d1bc9d9/attachment-0001.html>


More information about the Gnutls-devel mailing list