]>
sourceware.org Git - systemtap.git/blob - stap-sign-module.cxx
2 This program signs the given file using the named certificate and private
3 key in the given certificate database and places the signature in the named
6 Copyright (C) 2009-2011 Red Hat Inc.
8 This file is part of systemtap, and is free software. You can
9 redistribute it and/or modify it under the terms of the GNU General Public
10 License as published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
31 #include "nsscommon.h"
35 // Called by methods within nsscommon.cxx.
38 nsscommon_error (const char *msg
, int logit
__attribute ((unused
)))
40 clog
<< msg
<< endl
<< flush
;
44 main (int argc
, char **argv
)
47 setlocale (LC_ALL
, "");
48 bindtextdomain (PACKAGE
, LOCALEDIR
);
53 nsscommon_error (_("Module name was not specified."));
56 string module_name
= argv
[1];
60 cert_db_path
= argv
[2];
62 cert_db_path
= server_cert_db_path ();
64 const char *nickName
= server_cert_nickname ();
65 if (check_cert (cert_db_path
, nickName
) != 0)
68 /* Call the NSPR initialization routines. */
69 PR_Init (PR_SYSTEM_THREAD
, PR_PRIORITY_NORMAL
, 1);
71 /* Set the cert database password callback. */
72 PK11_SetPasswordFunc (nssPasswordCallback
);
75 SECStatus secStatus
= nssInit (cert_db_path
.c_str());
76 if (secStatus
!= SECSuccess
)
78 // Message already issued.
82 sign_file (cert_db_path
, nickName
, module_name
, module_name
+ ".sgn");
84 /* Shutdown NSS and exit NSPR gracefully. */
85 nssCleanup (cert_db_path
.c_str ());
91 /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.042912 seconds and 5 git commands to generate.