2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
26 #include "net_nfc_sign_record.h"
27 #include "ndef-tool.h"
29 bool ndef_tool_sign_message_from_file(const char *file_name, int begin_index, int end_index, char *cert_file, char *password)
32 ndef_message_s *msg = NULL;
35 if (ndef_tool_read_ndef_message_from_file(file_name, &msg) > 0)
37 net_nfc_get_ndef_message_record_count(msg, &count);
39 if (count > end_index)
41 fprintf(stdout, "count : %d\n", count);
43 net_nfc_sign_records(msg, begin_index, end_index, cert_file, password);
45 ndef_tool_write_ndef_message_to_file(file_name, msg);
50 net_nfc_free_ndef_message(msg);
56 bool ndef_tool_verify_message_from_file(const char *file_name)
59 ndef_message_s *msg = NULL;
61 if (ndef_tool_read_ndef_message_from_file(file_name, &msg) > 0)
63 result = (net_nfc_verify_signature_ndef_message(msg) == 0);
65 net_nfc_free_ndef_message(msg);