On Sun, Jun 16, 2013 at 09:35:58PM -0400, David Geib wrote:

> I am trying to implement functionality similar to what ssh does with
> authorized_keys. I have a list of valid public keys (really public key
> fingerprints in my case) and I want to verify whether the peer has one of
> the valid keys.
> 
> My attempt to do this is to use SSL_CTX_set_cert_verify_callback to set a
> callback which does the following:

The callback can just return 1 unconditionally, and you can verify
the leaf certificate after the handshake completes.  You can create
the callback with SSL_VERIFY_NONE to make sure the handshake is
not aborted prematurely.

> This seems to work. Obviously it causes things like certificate chains,
> whether the certificate has a valid signature, whether the certificate has
> expired, etc. to be ignored. I'm only interested in whether the public key
> the peer will use for authentication is on the valid list. What I would
> prefer is to not use certificates at all and use only public keys, but I'm
> not aware of any way to do that. Is there a way to use public keys without
> certificates? If not, am I doing this in a sensible and secure way or what
> should I be doing instead?

TLS does not at this time support bare public keys, you need to wrap
them in certificates.  Anyway what you're doing is fine, see for example:

  http://www.postfix.org/TLS_README.html#client_tls_fprint

  http://vdukhovni.github.io/postfix/postconf.5.html#smtp_tls_trust_anchor_file

-- 
        Viktor.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to