21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

sign_key<br />

If the sign_cert member is non-NULL, this member must be filled in with a<br />

pointer to the private key to use in signing the request. It is ignored if the sign_<br />

cert member is NULL.<br />

skew<br />

An OCSP response contains three time fields: thisUpdate, nextUpdate, and<br />

producedAt. These fields must be checked to determine how reliable the results<br />

from the responder are. For example, under no circumstance should thisUpdate<br />

ever be greater than nextUpdate. However, it is likely that there will be some<br />

amount of clock skew between the server and the client. skew defines an acceptable<br />

amount of skew in units of seconds. It should be set to a reasonably low<br />

value. In most cases, five seconds should work out fine.<br />

maxage<br />

RFC 2560 OCSP responders are allowed to precompute responses to improve<br />

response time by eliminating the need to sign a response for every request. There<br />

are obvious security implications if a server opts to do this, as we discussed in<br />

Recipe 10.1. The producedAt field in the response will contain the time at which<br />

the response was computed, whether or not it was precomputed. The maxage<br />

member specifies the maximum age in seconds of responses that should be considered<br />

acceptable. Setting maxage to 0 will effectively cause the producedAt field<br />

in the response to be ignored and any otherwise acceptable response to be<br />

accepted, regardless of its age. OpenSSL’s command-line ocsp command defaults<br />

to ignoring the producedAt field. However, we think it is too risky to accept precomputed<br />

responses. Unfortunately, there is no way to completely disable the<br />

acceptance of precomputed responses. The closest we can get is to set this value<br />

to one second, which is what we recommend you do.<br />

Querying an OCSP responder is actually a complex operation, even though we are<br />

effectively reducing the amount of work necessary for you to a single function call.<br />

Because of the complexity of the operation, a number of things can go wrong, and so<br />

we have defined a sizable number of possible error codes. In some cases, we have<br />

lumped a number of finer-grained errors into a single error code, but the code presented<br />

here can easily be expanded to provide more detailed error information.<br />

typedef enum {<br />

SPC_OCSPRESULT_ERROR_INVALIDRESPONSE = -12,<br />

SPC_OCSPRESULT_ERROR_CONNECTFAILURE = -11,<br />

SPC_OCSPRESULT_ERROR_SIGNFAILURE = -10,<br />

SPC_OCSPRESULT_ERROR_BADOCSPADDRESS = -9,<br />

SPC_OCSPRESULT_ERROR_OUTOFMEMORY = -8,<br />

SPC_OCSPRESULT_ERROR_UNKNOWN = -7,<br />

SPC_OCSPRESULT_ERROR_UNAUTHORIZED = -6,<br />

SPC_OCSPRESULT_ERROR_SIGREQUIRED = -5,<br />

SPC_OCSPRESULT_ERROR_TRYLATER = -3,<br />

SPC_OCSPRESULT_ERROR_INTERNALERROR = -2,<br />

SPC_OCSPRESULT_ERROR_MALFORMEDREQUEST = -1,<br />

564 | Chapter 10: Public Key Infrastructure<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!