Discuss this help topic in SecureBlackbox Forum
Configure TSP server
TSP server components included in SecureBlackbox implement solely the TSP (RFC3161) functionality. To process HTTP requests, they require external HTTP(S) components. Either HTTPBlackbox, or any other HTTP implementation allowing to pass dedicated TSP requests for external handling, will do.
Prior to implementing the TSP server, the HTTP server component needs to be set up and configured. Your server should be able to: (1) handle POST requests with 'application/timestamp-query' content type; (2) forward them to the request handler; (3) receive results from the handler; (4) send them back as an HTTP response with 'application/timestamp-reply' content type.
The TSP request handler expects a properly formed TSP request on input (received from the HTTP server), and returns the corresponding TSP response.
TElFileTSPServer tspServer = new TElFileTSPServer();
TElMemoryCertStorage signingCerts = new TElMemoryCertStorage();
signingCerts.Add(signingCert, true);
signingCerts.Add(caCert, true);
tspServer.Certificates = signingCerts;
tspServer.LoadRequestFromStream(request);
tspServer.TSPInfo.Time = DateTime.UtcNow;
tspServer.TSPInfo.TSAName.NameType = TSBGeneralName.gnDirectoryName;
tspServer.TSPInfo.TSAName.DirectoryName.Assign(signingCert.SubjectRDN);
tspServer.TSPInfo.TSANameSet = true;
// possible values: psGranted, psGrantedWithMods, psRejection, psWaiting, psRevocationWarning, psRevocationNotification, psKeyUpdateWarning
int serverResult = SBPKICommon.Unit.psGranted;
// possible values: SBPKICommon.Unit.pfiBadAlg, pfiBadMessageCheck, pfiBadRequest, pfiBadTime, pfiBadCertId, pfiBadDataFormat,
// pfiWrongAuthority, pfiIncorrectData, pfiMissingTimeStamp, pfiBadPOP
int failureInfo = 0; // is ignored if serverResult is psGranted or psGrantedWithMods
bool res = tspServer.SaveReplyToStream(serverResult, failureInfo, destStream);
If res is true, the signing has succeeded.
Pass the contents of destStream back to the HTTP server.
It will forward the response to the connected client with the 'application/timestamp-reply' content type.