merge with master
authorJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:18:25 +0000 (01:18 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:18:25 +0000 (01:18 +0900)
111 files changed:
client/CMakeLists.txt
client/ClientChannel.cpp
client/ClientDispatcher.cpp
client/ClientIPC.cpp
client/Reader.cpp
client/SEService.cpp
client/Session.cpp
client/include/ClientChannel.h
client/include/ClientDispatcher.h
client/include/ClientIPC.h
client/include/Reader.h
client/include/SEService.h
client/include/SEServiceListener.h
client/include/Session.h
client/include/smartcard-service.h [new file with mode: 0644]
common/APDUHelper.cpp
common/AccessCondition.cpp
common/AccessControlList.cpp
common/ByteArray.cpp
common/CMakeLists.txt
common/DispatcherHelper.cpp
common/EFDIR.cpp [new file with mode: 0644]
common/Exception.cpp [new file with mode: 0644]
common/FCI.cpp
common/FileObject.cpp
common/GPSEACL.cpp
common/IPCHelper.cpp
common/ISO7816BERTLV.cpp
common/Message.cpp
common/NumberStream.cpp
common/PKCS15.cpp
common/PKCS15DODF.cpp
common/PKCS15ODF.cpp
common/PKCS15OID.cpp
common/PKCS15Object.cpp
common/PKCS15Path.cpp
common/PKCS15TokenInfo.cpp
common/ProviderHelper.cpp
common/ReaderHelper.cpp
common/Record.cpp [deleted file]
common/SEServiceHelper.cpp
common/Serializable.cpp
common/SessionHelper.cpp
common/SignatureHelper.cpp
common/SimpleTLV.cpp
common/Synchronous.cpp
common/TLVHelper.cpp
common/include/APDUHelper.h
common/include/AccessCondition.h
common/include/AccessControlList.h
common/include/ByteArray.h
common/include/Channel.h
common/include/Debug.h
common/include/DispatcherHelper.h
common/include/DispatcherMsg.h
common/include/EFDIR.h [new file with mode: 0644]
common/include/Exception.h [new file with mode: 0644]
common/include/FCI.h
common/include/FileObject.h
common/include/GPSEACL.h
common/include/IPCHelper.h
common/include/ISO7816BERTLV.h
common/include/Lock.h
common/include/Message.h
common/include/NumberStream.h
common/include/OpensslHelper.h
common/include/PKCS15.h
common/include/PKCS15DODF.h
common/include/PKCS15ODF.h
common/include/PKCS15OID.h
common/include/PKCS15Object.h
common/include/PKCS15Path.h
common/include/PKCS15TokenInfo.h
common/include/ProviderHelper.h
common/include/ReaderHelper.h
common/include/Record.h
common/include/SEServiceHelper.h
common/include/Serializable.h
common/include/SessionHelper.h
common/include/SignatureHelper.h
common/include/SimpleTLV.h
common/include/Synchronous.h
common/include/TLVHelper.h
common/include/Terminal.h
common/include/TerminalInterface.h
common/include/smartcard-types.h
packaging/smartcard-service.spec
server/CMakeLists.txt
server/ClientInstance.cpp
server/ServerChannel.cpp
server/ServerDispatcher.cpp
server/ServerIPC.cpp
server/ServerReader.cpp
server/ServerResource.cpp
server/ServerSEService.cpp
server/ServerSession.cpp
server/ServiceInstance.cpp
server/include/ClientInstance.h
server/include/ServerChannel.h
server/include/ServerDispatcher.h
server/include/ServerIPC.h
server/include/ServerReader.h
server/include/ServerResource.h
server/include/ServerSEService.h
server/include/ServerSession.h
server/include/ServiceInstance.h
server/smartcard-daemon.cpp
smartcard-service-server.manifest
test-client/CMakeLists.txt
test-client/test-client-sync.cpp
test-client/test-client.cpp

index 08f2b32..b766051 100644 (file)
@@ -62,6 +62,7 @@ SET(EXPORT_HEADER
        ../common/include/smartcard-types.h
        ../common/include/ByteArray.h
        ../common/include/Debug.h
        ../common/include/smartcard-types.h
        ../common/include/ByteArray.h
        ../common/include/Debug.h
+       ../common/include/Exception.h
        ../common/include/Synchronous.h
        ../common/include/APDUHelper.h
        ../common/include/Channel.h
        ../common/include/Synchronous.h
        ../common/include/APDUHelper.h
        ../common/include/Channel.h
@@ -76,6 +77,7 @@ SET(EXPORT_HEADER
        include/Reader.h
        include/Session.h
        include/ClientChannel.h
        include/Reader.h
        include/Session.h
        include/ClientChannel.h
+       include/smartcard-service.h
 #      include/
 )
 
 #      include/
 )
 
index eb2d177..b74ba0f 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdlib.h>
 
 /* standard library header */
 #include <stdlib.h>
@@ -27,6 +27,7 @@
 #include "ClientIPC.h"
 #include "ClientChannel.h"
 #include "ReaderHelper.h"
 #include "ClientIPC.h"
 #include "ClientChannel.h"
 #include "ReaderHelper.h"
+#include "APDUHelper.h"
 
 #ifndef EXTERN_API
 #define EXTERN_API __attribute__((visibility("default")))
 
 #ifndef EXTERN_API
 #define EXTERN_API __attribute__((visibility("default")))
@@ -34,7 +35,9 @@
 
 namespace smartcard_service_api
 {
 
 namespace smartcard_service_api
 {
-       ClientChannel::ClientChannel(void *context, Session *session, int channelNum, ByteArray selectResponse, void *handle):Channel(session)
+       ClientChannel::ClientChannel(void *context, Session *session,
+               int channelNum, ByteArray selectResponse, void *handle)
+               : Channel(session)
        {
                this->channelNum = -1;
                this->handle = NULL;
        {
                this->channelNum = -1;
                this->handle = NULL;
@@ -58,7 +61,7 @@ namespace smartcard_service_api
                closeSync();
        }
 
                closeSync();
        }
 
-       void ClientChannel::closeSync()
+       void ClientChannel::closeSync() throw(ErrorIO &, ErrorIllegalState &)
        {
 #ifdef CLIENT_IPC_THREAD
                if (isClosed() == false)
        {
 #ifdef CLIENT_IPC_THREAD
                if (isClosed() == false)
@@ -75,20 +78,30 @@ namespace smartcard_service_api
                                msg.caller = (void *)this;
                                msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
 
                                msg.caller = (void *)this;
                                msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
 
-                               syncLock();
-                               if (ClientIPC::getInstance().sendMessage(&msg) == true)
+                               try
                                {
                                {
-                                       rv = waitTimedCondition(0);
-                                       if (rv < 0)
+                                       syncLock();
+                                       if (ClientIPC::getInstance().sendMessage(&msg) == true)
+                                       {
+                                               rv = waitTimedCondition(0);
+                                               if (rv < 0)
+                                               {
+                                                       SCARD_DEBUG_ERR("closeSync failed [%d]", rv);
+                                               }
+                                       }
+                                       else
                                        {
                                        {
-                                               SCARD_DEBUG_ERR("closeSync failed [%d]", rv);
+                                               SCARD_DEBUG_ERR("sendMessage failed");
+                                               throw ErrorIO(SCARD_ERROR_IPC_FAILED);
                                        }
                                        }
+                                       syncUnlock();
                                }
                                }
-                               else
+                               catch (ExceptionBase &e)
                                {
                                {
-                                       SCARD_DEBUG_ERR("sendMessage failed");
+                                       syncUnlock();
+
+                                       throw e;
                                }
                                }
-                               syncUnlock();
 
                                channelNum = -1;
                        }
 
                                channelNum = -1;
                        }
@@ -140,6 +153,7 @@ namespace smartcard_service_api
        }
 
        int ClientChannel::transmitSync(ByteArray command, ByteArray &result)
        }
 
        int ClientChannel::transmitSync(ByteArray command, ByteArray &result)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                int rv = -1;
 
        {
                int rv = -1;
 
@@ -169,7 +183,7 @@ namespace smartcard_service_api
                                }
                                else
                                {
                                }
                                else
                                {
-                                       SCARD_DEBUG_ERR("clientIPC is null");
+                                       SCARD_DEBUG_ERR("timeout");
 
                                        rv = -1;
                                }
 
                                        rv = -1;
                                }
@@ -184,6 +198,7 @@ namespace smartcard_service_api
                else
                {
                        SCARD_DEBUG_ERR("unavailable channel");
                else
                {
                        SCARD_DEBUG_ERR("unavailable channel");
+                       throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE);
                }
 
                return rv;
                }
 
                return rv;
@@ -245,6 +260,14 @@ namespace smartcard_service_api
                                /* transmit result */
                                SCARD_DEBUG("MSG_REQUEST_TRANSMIT");
 
                                /* transmit result */
                                SCARD_DEBUG("MSG_REQUEST_TRANSMIT");
 
+                               if (msg->error == 0 &&
+                                       ResponseHelper::getStatus(msg->data) == 0)
+                               {
+                                       /* store select response */
+                                       if (msg->data.getAt(1) == APDUCommand::INS_SELECT_FILE)
+                                               channel->setSelectResponse(msg->data);
+                               }
+
                                if (msg->isSynchronousCall() == true) /* synchronized call */
                                {
                                        /* sync call */
                                if (msg->isSynchronousCall() == true) /* synchronized call */
                                {
                                        /* sync call */
@@ -326,7 +349,8 @@ EXTERN_API int channel_close(channel_h handle, channel_close_cb callback, void *
        return result;
 }
 
        return result;
 }
 
-EXTERN_API int channel_transmit(channel_h handle, unsigned char *command, unsigned int length, channel_transmit_cb callback, void *userParam)
+EXTERN_API int channel_transmit(channel_h handle, unsigned char *command,
+       unsigned int length, channel_transmit_cb callback, void *userParam)
 {
        int result = -1;
 
 {
        int result = -1;
 
@@ -344,12 +368,19 @@ EXTERN_API void channel_close_sync(channel_h handle)
 {
 #ifdef CLIENT_IPC_THREAD
        CHANNEL_EXTERN_BEGIN;
 {
 #ifdef CLIENT_IPC_THREAD
        CHANNEL_EXTERN_BEGIN;
-       channel->closeSync();
+       try
+       {
+               channel->closeSync();
+       }
+       catch (...)
+       {
+       }
        CHANNEL_EXTERN_END;
 #endif
 }
 
        CHANNEL_EXTERN_END;
 #endif
 }
 
-EXTERN_API int channel_transmit_sync(channel_h handle, unsigned char *command, unsigned int cmd_len, unsigned char **response, unsigned int *resp_len)
+EXTERN_API int channel_transmit_sync(channel_h handle, unsigned char *command,
+       unsigned int cmd_len, unsigned char **response, unsigned int *resp_len)
 {
        int result = -1;
 
 {
        int result = -1;
 
@@ -361,12 +392,20 @@ EXTERN_API int channel_transmit_sync(channel_h handle, unsigned char *command, u
        ByteArray temp, resp;
 
        temp.setBuffer(command, cmd_len);
        ByteArray temp, resp;
 
        temp.setBuffer(command, cmd_len);
-       result = channel->transmitSync(temp, resp);
-       if (resp.getLength() > 0)
+
+       try
        {
        {
-               *resp_len = resp.getLength();
-               *response = (unsigned char *)calloc(1, *resp_len);
-               memcpy(*response, resp.getBuffer(), *resp_len);
+               result = channel->transmitSync(temp, resp);
+               if (resp.getLength() > 0)
+               {
+                       *resp_len = resp.getLength();
+                       *response = (unsigned char *)calloc(1, *resp_len);
+                       memcpy(*response, resp.getBuffer(), *resp_len);
+               }
+       }
+       catch (...)
+       {
+               result = -1;
        }
        CHANNEL_EXTERN_END;
 #endif
        }
        CHANNEL_EXTERN_END;
 #endif
@@ -407,7 +446,8 @@ EXTERN_API unsigned int channel_get_select_response_length(channel_h handle)
        return result;
 }
 
        return result;
 }
 
-EXTERN_API bool channel_get_select_response(channel_h handle, unsigned char *buffer, unsigned int length)
+EXTERN_API bool channel_get_select_response(channel_h handle,
+       unsigned char *buffer, unsigned int length)
 {
        bool result = false;
 
 {
        bool result = false;
 
@@ -443,7 +483,5 @@ EXTERN_API session_h channel_get_session(channel_h handle)
 
 EXTERN_API void channel_destroy_instance(channel_h handle)
 {
 
 EXTERN_API void channel_destroy_instance(channel_h handle)
 {
-       CHANNEL_EXTERN_BEGIN;
-       delete channel;
-       CHANNEL_EXTERN_END;
+       /* do nothing */
 }
 }
index 9872d93..158689e 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <glib.h>
 
 /* standard library header */
 #include <glib.h>
index e57ab6e..de28bba 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <sys/socket.h>
 
 /* standard library header */
 #include <sys/socket.h>
@@ -37,7 +36,7 @@ namespace smartcard_service_api
                _launch_daemon();
 #endif
 #ifdef SECURITY_SERVER
                _launch_daemon();
 #endif
 #ifdef SECURITY_SERVER
-               int length = 0;
+               int length;
 
                if ((length = security_server_get_cookie_size()) > 0)
                {
 
                if ((length = security_server_get_cookie_size()) > 0)
                {
@@ -46,9 +45,10 @@ namespace smartcard_service_api
                        buffer = new uint8_t[length];
                        if (buffer != NULL)
                        {
                        buffer = new uint8_t[length];
                        if (buffer != NULL)
                        {
-                               int error = 0;
+                               int error;
 
 
-                               if ((error = security_server_request_cookie(buffer, length)) == SECURITY_SERVER_API_SUCCESS)
+                               if ((error = security_server_request_cookie(buffer, length))
+                                       == SECURITY_SERVER_API_SUCCESS)
                                {
                                        cookie.setBuffer(buffer, length);
 
                                {
                                        cookie.setBuffer(buffer, length);
 
@@ -83,10 +83,8 @@ namespace smartcard_service_api
 #ifdef USE_AUTOSTART
        void ClientIPC::_launch_daemon()
        {
 #ifdef USE_AUTOSTART
        void ClientIPC::_launch_daemon()
        {
-               DBusGConnection *connection = NULL;
-               DBusGProxy *proxy = NULL;
+               DBusGConnection *connection;
                GError *error = NULL;
                GError *error = NULL;
-               gint result = 0;
 
                SCARD_BEGIN();
 
 
                SCARD_BEGIN();
 
@@ -97,10 +95,16 @@ namespace smartcard_service_api
                connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
                if (error == NULL)
                {
                connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
                if (error == NULL)
                {
-                       proxy = dbus_g_proxy_new_for_name(connection, "org.tizen.smartcard_service", "/org/tizen/smartcard_service", "org.tizen.smartcard_service");
+                       DBusGProxy *proxy;
+
+                       proxy = dbus_g_proxy_new_for_name(connection, "org.tizen.smartcard_service",
+                               "/org/tizen/smartcard_service", "org.tizen.smartcard_service");
                        if (proxy != NULL)
                        {
                        if (proxy != NULL)
                        {
-                               if (dbus_g_proxy_call(proxy, "launch", &error, G_TYPE_INVALID, G_TYPE_INT, &result, G_TYPE_INVALID) == false)
+                               gint result = 0;
+
+                               if (dbus_g_proxy_call(proxy, "launch", &error, G_TYPE_INVALID,
+                                       G_TYPE_INT, &result, G_TYPE_INVALID) == false)
                                {
                                        SCARD_DEBUG_ERR("org_tizen_smartcard_service_launch failed");
                                        if (error != NULL)
                                {
                                        SCARD_DEBUG_ERR("org_tizen_smartcard_service_launch failed");
                                        if (error != NULL)
@@ -130,7 +134,7 @@ namespace smartcard_service_api
        bool ClientIPC::sendMessage(Message *msg)
        {
                ByteArray stream;
        bool ClientIPC::sendMessage(Message *msg)
        {
                ByteArray stream;
-               unsigned int length = 0;
+               unsigned int length;
 
                if (ipcSocket == -1)
                        return false;
 
                if (ipcSocket == -1)
                        return false;
@@ -142,23 +146,24 @@ namespace smartcard_service_api
 #endif
                length = stream.getLength();
 
 #endif
                length = stream.getLength();
 
-               SCARD_DEBUG(">>>[SEND]>>> socket [%d], msg [%d], length [%d]", ipcSocket, msg->message, stream.getLength());
+               SCARD_DEBUG(">>>[SEND]>>> socket [%d], msg [%d], length [%d]",
+                       ipcSocket, msg->message, stream.getLength());
 
                return IPCHelper::sendMessage(ipcSocket, stream);
        }
 
        int ClientIPC::handleIOErrorCondition(void *channel, GIOCondition condition)
        {
 
                return IPCHelper::sendMessage(ipcSocket, stream);
        }
 
        int ClientIPC::handleIOErrorCondition(void *channel, GIOCondition condition)
        {
-               DispatcherMsg dispMsg;
-
                SCARD_BEGIN();
 
                SCARD_BEGIN();
 
-               /* push or process disconnect message */
-               dispMsg.message = Message::MSG_OPERATION_RELEASE_CLIENT;
-               dispMsg.error = -1;
-
                if (dispatcher != NULL)
                {
                if (dispatcher != NULL)
                {
+                       DispatcherMsg dispMsg;
+
+                       /* push or process disconnect message */
+                       dispMsg.message = Message::MSG_OPERATION_RELEASE_CLIENT;
+                       dispMsg.error = -1;
+
 #ifdef CLIENT_IPC_THREAD
                        dispatcher->processMessage(&dispMsg);
 #else
 #ifdef CLIENT_IPC_THREAD
                        dispatcher->processMessage(&dispMsg);
 #else
index 248c895..4382de9 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -28,7 +27,6 @@
 #include "ClientIPC.h"
 #include "Reader.h"
 #include "Session.h"
 #include "ClientIPC.h"
 #include "Reader.h"
 #include "Session.h"
-#include "SignatureHelper.h"
 
 #ifndef EXTERN_API
 #define EXTERN_API __attribute__((visibility("default")))
 
 #ifndef EXTERN_API
 #define EXTERN_API __attribute__((visibility("default")))
@@ -36,7 +34,7 @@
 
 namespace smartcard_service_api
 {
 
 namespace smartcard_service_api
 {
-       Reader::Reader(void *context, const char *name, void *handle):ReaderHelper()
+       Reader::Reader(void *context, const char *name, void *handle) : ReaderHelper()
        {
                unsigned int length = 0;
 
        {
                unsigned int length = 0;
 
@@ -61,10 +59,6 @@ namespace smartcard_service_api
 
                present = true;
 
 
                present = true;
 
-#if 0
-               getPackageCert();
-#endif
-
                SCARD_END();
        }
 
                SCARD_END();
        }
 
@@ -83,6 +77,7 @@ namespace smartcard_service_api
        }
 
        void Reader::closeSessions()
        }
 
        void Reader::closeSessions()
+               throw(ErrorIO &, ErrorIllegalState &)
        {
                size_t i;
 
        {
                size_t i;
 
@@ -92,12 +87,8 @@ namespace smartcard_service_api
                }
        }
 
                }
        }
 
-       void Reader::getPackageCert()
-       {
-               packageCert = SignatureHelper::getCertificationHash(getpid());
-       }
-
        SessionHelper *Reader::openSessionSync()
        SessionHelper *Reader::openSessionSync()
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                openedSession = NULL;
 
        {
                openedSession = NULL;
 
@@ -110,7 +101,6 @@ namespace smartcard_service_api
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_OPEN_SESSION;
                        msg.param1 = (unsigned int)handle;
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_OPEN_SESSION;
                        msg.param1 = (unsigned int)handle;
-                       msg.data = packageCert;
                        msg.error = (unsigned int)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
                        msg.error = (unsigned int)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
@@ -152,9 +142,6 @@ namespace smartcard_service_api
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_OPEN_SESSION;
                        msg.param1 = (unsigned int)handle;
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_OPEN_SESSION;
                        msg.param1 = (unsigned int)handle;
-#if 0
-                       msg.data = packageCert;
-#endif
                        msg.error = (unsigned int)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)callback;
                        msg.error = (unsigned int)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)callback;
@@ -332,7 +319,4 @@ EXTERN_API void reader_close_sessions(reader_h handle)
 
 EXTERN_API void reader_destroy_instance(reader_h handle)
 {
 
 EXTERN_API void reader_destroy_instance(reader_h handle)
 {
-       READER_EXTERN_BEGIN;
-       delete reader;
-       READER_EXTERN_END;
 }
 }
index 366e9dc..2cb27e8 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <unistd.h>
 
 /* standard library header */
 #include <unistd.h>
 
 namespace smartcard_service_api
 {
 
 namespace smartcard_service_api
 {
-       SEService::SEService():SEServiceHelper()
+       SEService::SEService() :
+               SEServiceHelper()
        {
        {
-               pid = -1;
                this->context = NULL;
                this->handler = NULL;
                this->listener = NULL;
                connected = false;
                this->context = NULL;
                this->handler = NULL;
                this->listener = NULL;
                connected = false;
-
-               pid = getpid();
        }
 
        }
 
-       SEService::SEService(void *user_data, serviceConnected handler):SEServiceHelper()
+       SEService::SEService(void *user_data, serviceConnected handler)
+               throw(ErrorIO &, ErrorIllegalParameter &) :
+               SEServiceHelper()
        {
        {
-               pid = -1;
-               this->context = NULL;
-               this->handler = NULL;
                this->listener = NULL;
                connected = false;
 
                this->listener = NULL;
                connected = false;
 
-               pid = getpid();
-
                initialize(user_data, handler);
        }
 
                initialize(user_data, handler);
        }
 
-       SEService::SEService(void *user_data, SEServiceListener *listener):SEServiceHelper()
+       SEService::SEService(void *user_data, SEServiceListener *listener)
+               throw(ErrorIO &, ErrorIllegalParameter &) :
+               SEServiceHelper()
        {
        {
-               pid = -1;
-               this->context = NULL;
                this->handler = NULL;
                this->handler = NULL;
-               this->listener = NULL;
                connected = false;
 
                connected = false;
 
-               pid = getpid();
-
                initialize(user_data, listener);
        }
 
                initialize(user_data, listener);
        }
 
@@ -77,7 +68,18 @@ namespace smartcard_service_api
        {
                uint32_t i;
 
        {
                uint32_t i;
 
-               shutdownSync();
+               try
+               {
+                       shutdownSync();
+               }
+               catch(ExceptionBase &e)
+               {
+                       SCARD_DEBUG_ERR("EXCEPTION : %s", e.what());
+               }
+               catch(...)
+               {
+                       SCARD_DEBUG_ERR("EXCEPTION!!!");
+               }
 
                for (i = 0; i < readers.size(); i++)
                {
 
                for (i = 0; i < readers.size(); i++)
                {
@@ -86,6 +88,18 @@ namespace smartcard_service_api
                readers.clear();
        }
 
                readers.clear();
        }
 
+       SEService *SEService::createInstance(void *user_data, SEServiceListener *listener)
+               throw(ErrorIO &, ErrorIllegalParameter &)
+       {
+               return new SEService(user_data, listener);
+       }
+
+       SEService *SEService::createInstance(void *user_data, serviceConnected handler)
+               throw(ErrorIO &, ErrorIllegalParameter &)
+       {
+               return new SEService(user_data, handler);
+       }
+
        void SEService::shutdown()
        {
                if (connected == true)
        void SEService::shutdown()
        {
                if (connected == true)
@@ -102,7 +116,7 @@ namespace smartcard_service_api
                        msg.message = Message::MSG_REQUEST_SHUTDOWN;
                        msg.error = (unsigned int)this; /* using error to context */
                        msg.caller = (void *)this;
                        msg.message = Message::MSG_REQUEST_SHUTDOWN;
                        msg.error = (unsigned int)this; /* using error to context */
                        msg.caller = (void *)this;
-                       msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
+                       msg.callback = (void *)NULL;
 
                        if (ClientIPC::getInstance().sendMessage(&msg) == false)
                        {
 
                        if (ClientIPC::getInstance().sendMessage(&msg) == false)
                        {
@@ -124,7 +138,6 @@ namespace smartcard_service_api
                        }
 
                        /* send message to load se */
                        }
 
                        /* send message to load se */
-                       int rv;
                        Message msg;
 
                        msg.message = Message::MSG_REQUEST_SHUTDOWN;
                        Message msg;
 
                        msg.message = Message::MSG_REQUEST_SHUTDOWN;
@@ -135,6 +148,8 @@ namespace smartcard_service_api
                        syncLock();
                        if (ClientIPC::getInstance().sendMessage(&msg) == true)
                        {
                        syncLock();
                        if (ClientIPC::getInstance().sendMessage(&msg) == true)
                        {
+                               int rv;
+
                                rv = waitTimedCondition(0);
 
                                if (rv == 0)
                                rv = waitTimedCondition(0);
 
                                if (rv == 0)
@@ -157,11 +172,11 @@ namespace smartcard_service_api
 #endif
        }
 
 #endif
        }
 
-       bool SEService::_initialize()
+       bool SEService::_initialize() throw(ErrorIO &)
        {
                bool result = false;
        {
                bool result = false;
-               ClientIPC *clientIPC = NULL;
-               ClientDispatcher *clientDispatcher = NULL;
+               ClientIPC *clientIPC;
+               ClientDispatcher *clientDispatcher;
 
                SCARD_BEGIN();
 
 
                SCARD_BEGIN();
 
@@ -199,7 +214,7 @@ namespace smartcard_service_api
                        Message msg;
 
                        msg.message = Message::MSG_REQUEST_READERS;
                        Message msg;
 
                        msg.message = Message::MSG_REQUEST_READERS;
-                       msg.error = pid; /* using error to pid */
+                       msg.error = getpid(); /* using error to pid */
                        msg.caller = (void *)this;
                        msg.userParam = context;
 
                        msg.caller = (void *)this;
                        msg.userParam = context;
 
@@ -212,11 +227,13 @@ namespace smartcard_service_api
        }
 
        bool SEService::initialize(void *context, serviceConnected handler)
        }
 
        bool SEService::initialize(void *context, serviceConnected handler)
+               throw(ErrorIO &, ErrorIllegalParameter &)
        {
                if (context == NULL)
                {
        {
                if (context == NULL)
                {
-                       SCARD_DEBUG_ERR("invalid param");
-                       return false;
+                       ErrorIllegalParameter e(0);
+
+                       throw e;
                }
 
                this->context = context;
                }
 
                this->context = context;
@@ -226,11 +243,13 @@ namespace smartcard_service_api
        }
 
        bool SEService::initialize(void *context, SEServiceListener *listener)
        }
 
        bool SEService::initialize(void *context, SEServiceListener *listener)
+               throw(ErrorIO &, ErrorIllegalParameter &)
        {
                if (context == NULL)
                {
        {
                if (context == NULL)
                {
-                       SCARD_DEBUG_ERR("invalid param");
-                       return false;
+                       ErrorIllegalParameter e(0);
+
+                       throw e;
                }
 
                this->context = context;
                }
 
                this->context = context;
@@ -324,16 +343,12 @@ namespace smartcard_service_api
 
                                /* copy result */
 //                             service->error = msg->error;
 
                                /* copy result */
 //                             service->error = msg->error;
-
                                service->signalCondition();
                                service->syncUnlock();
                        }
                        else
                        {
                                service->signalCondition();
                                service->syncUnlock();
                        }
                        else
                        {
-//                             openSessionCallback cb = (openSessionCallback)msg->callback;
-//
-//                             /* async call */
-//                             cb(session, msg->error, msg->userParam);
+                               /* Do nothing... */
                        }
                        break;
 
                        }
                        break;
 
@@ -344,7 +359,8 @@ namespace smartcard_service_api
                                SCARD_DEBUG("[MSG_NOTIFY_SE_INSERTED]");
 
                                /* add readers */
                                SCARD_DEBUG("[MSG_NOTIFY_SE_INSERTED]");
 
                                /* add readers */
-                               reader = new Reader(service->context, (char *)msg->data.getBuffer(), (void *)msg->param1);
+                               reader = new Reader(service->context,
+                                       (char *)msg->data.getBuffer(), (void *)msg->param1);
                                if (reader != NULL)
                                {
                                        service->readers.push_back(reader);
                                if (reader != NULL)
                                {
                                        service->readers.push_back(reader);
@@ -356,7 +372,8 @@ namespace smartcard_service_api
 
                                if (service->listener != NULL)
                                {
 
                                if (service->listener != NULL)
                                {
-                                       service->listener->eventHandler(service, (char *)msg->data.getBuffer(), 1, service->context);
+                                       service->listener->eventHandler(service,
+                                               (char *)msg->data.getBuffer(), 1, service->context);
                                }
                                else
                                {
                                }
                                else
                                {
@@ -382,7 +399,8 @@ namespace smartcard_service_api
 
                                if (service->listener != NULL)
                                {
 
                                if (service->listener != NULL)
                                {
-                                       service->listener->eventHandler(service, (char *)msg->data.getBuffer(), 2, service->context);
+                                       service->listener->eventHandler(service,
+                                               (char *)msg->data.getBuffer(), 2, service->context);
                                }
                                else
                                {
                                }
                                else
                                {
@@ -407,7 +425,7 @@ namespace smartcard_service_api
                        }
                        break;
 
                        }
                        break;
 
-               default:
+               default :
                        SCARD_DEBUG("unknown message [%s]", msg->toString());
                        break;
                }
                        SCARD_DEBUG("unknown message [%s]", msg->toString());
                        break;
                }
@@ -436,14 +454,33 @@ using namespace smartcard_service_api;
 
 EXTERN_API se_service_h se_service_create_instance(void *user_data, se_service_connected_cb callback)
 {
 
 EXTERN_API se_service_h se_service_create_instance(void *user_data, se_service_connected_cb callback)
 {
-       SEService *service = new SEService(user_data, (serviceConnected)callback);
+       SEService *service;
+
+       try
+       {
+               service = new SEService(user_data, (serviceConnected)callback);
+       }
+       catch (...)
+       {
+               service = NULL;
+       }
 
        return (se_service_h)service;
 }
 
 
        return (se_service_h)service;
 }
 
-EXTERN_API se_service_h se_service_create_instance_with_event_callback(void *user_data, se_service_connected_cb connected, se_service_event_cb event, se_sesrvice_error_cb error)
+EXTERN_API se_service_h se_service_create_instance_with_event_callback(void *user_data,
+       se_service_connected_cb connected, se_service_event_cb event, se_sesrvice_error_cb error)
 {
 {
-       SEService *service = new SEService(user_data, (serviceConnected)connected);
+       SEService *service;
+
+       try
+       {
+               service = new SEService(user_data, (serviceConnected)connected);
+       }
+       catch (...)
+       {
+               service = NULL;
+       }
 
        return (se_service_h)service;
 }
 
        return (se_service_h)service;
 }
@@ -453,10 +490,12 @@ EXTERN_API int se_service_get_readers_count(se_service_h handle)
        int count = 0;
 
        SE_SERVICE_EXTERN_BEGIN;
        int count = 0;
 
        SE_SERVICE_EXTERN_BEGIN;
+
        vector<ReaderHelper *> temp_readers;
 
        temp_readers = service->getReaders();
        count = temp_readers.size();
        vector<ReaderHelper *> temp_readers;
 
        temp_readers = service->getReaders();
        count = temp_readers.size();
+
        SE_SERVICE_EXTERN_END;
 
        return count;
        SE_SERVICE_EXTERN_END;
 
        return count;
@@ -467,6 +506,7 @@ EXTERN_API bool se_service_get_readers(se_service_h handle, reader_h *readers, i
        bool result = false;
 
        SE_SERVICE_EXTERN_BEGIN;
        bool result = false;
 
        SE_SERVICE_EXTERN_BEGIN;
+
        vector<ReaderHelper *> temp_readers;
        size_t i;
        int temp = 0;
        vector<ReaderHelper *> temp_readers;
        size_t i;
        int temp = 0;
@@ -482,6 +522,7 @@ EXTERN_API bool se_service_get_readers(se_service_h handle, reader_h *readers, i
                }
        }
        *count = temp;
                }
        }
        *count = temp;
+
        SE_SERVICE_EXTERN_END;
 
        return result;
        SE_SERVICE_EXTERN_END;
 
        return result;
@@ -492,7 +533,9 @@ EXTERN_API bool se_service_is_connected(se_service_h handle)
        bool result = false;
 
        SE_SERVICE_EXTERN_BEGIN;
        bool result = false;
 
        SE_SERVICE_EXTERN_BEGIN;
+
        result = service->isConnected();
        result = service->isConnected();
+
        SE_SERVICE_EXTERN_END;
 
        return result;
        SE_SERVICE_EXTERN_END;
 
        return result;
@@ -501,13 +544,17 @@ EXTERN_API bool se_service_is_connected(se_service_h handle)
 EXTERN_API void se_service_shutdown(se_service_h handle)
 {
        SE_SERVICE_EXTERN_BEGIN;
 EXTERN_API void se_service_shutdown(se_service_h handle)
 {
        SE_SERVICE_EXTERN_BEGIN;
+
        service->shutdown();
        service->shutdown();
+
        SE_SERVICE_EXTERN_END;
 }
 
 EXTERN_API void se_service_destroy_instance(se_service_h handle)
 {
        SE_SERVICE_EXTERN_BEGIN;
        SE_SERVICE_EXTERN_END;
 }
 
 EXTERN_API void se_service_destroy_instance(se_service_h handle)
 {
        SE_SERVICE_EXTERN_BEGIN;
+
        delete service;
        delete service;
+
        SE_SERVICE_EXTERN_END;
 }
        SE_SERVICE_EXTERN_END;
 }
index 2213d83..5bbe5a4 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -36,7 +35,8 @@
 
 namespace smartcard_service_api
 {
 
 namespace smartcard_service_api
 {
-       Session::Session(void *context, Reader *reader, void *handle):SessionHelper(reader)
+       Session::Session(void *context, Reader *reader, void *handle) :
+               SessionHelper(reader)
        {
                this->context = NULL;
 
        {
                this->context = NULL;
 
@@ -66,7 +66,7 @@ namespace smartcard_service_api
                channels.clear();
        }
 
                channels.clear();
        }
 
-       void Session::closeChannels()
+       void Session::closeChannels() throw (ErrorIO &, ErrorIllegalState &)
        {
                size_t i;
 
        {
                size_t i;
 
@@ -76,45 +76,50 @@ namespace smartcard_service_api
                }
        }
 
                }
        }
 
-       ByteArray Session::getATRSync()
+       ByteArray Session::getATRSync() throw (ErrorIO &, ErrorIllegalState &)
        {
        {
-               atr.releaseBuffer();
+               ByteArray result;
 
                if (getReader()->isSecureElementPresent() == true)
                {
 
                if (getReader()->isSecureElementPresent() == true)
                {
-                       Message msg;
-                       int rv;
+                       if (atr.isEmpty() == true)
+                       {
+                               Message msg;
+                               int rv;
 
 #ifdef CLIENT_IPC_THREAD
 
 #ifdef CLIENT_IPC_THREAD
-                       /* request channel handle from server */
-                       msg.message = Message::MSG_REQUEST_GET_ATR;
-                       msg.param1 = (unsigned int)handle;
-                       msg.error = (unsigned int)context; /* using error to context */
-                       msg.caller = (void *)this;
-                       msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
-
-                       syncLock();
-                       if (ClientIPC::getInstance().sendMessage(&msg) == true)
-                       {
-                               rv = waitTimedCondition(0);
-                               if (rv != 0)
+                               /* request channel handle from server */
+                               msg.message = Message::MSG_REQUEST_GET_ATR;
+                               msg.param1 = (unsigned int)handle;
+                               msg.error = (unsigned int)context; /* using error to context */
+                               msg.caller = (void *)this;
+                               msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
+
+                               syncLock();
+                               if (ClientIPC::getInstance().sendMessage(&msg) == true)
                                {
                                {
-                                       SCARD_DEBUG_ERR("time over");
+                                       rv = waitTimedCondition(0);
+                                       if (rv != 0)
+                                       {
+                                               SCARD_DEBUG_ERR("time over");
+                                       }
                                }
                                }
-                       }
-                       else
-                       {
-                               SCARD_DEBUG_ERR("sendMessage failed");
-                       }
-                       syncUnlock();
+                               else
+                               {
+                                       SCARD_DEBUG_ERR("sendMessage failed");
+                               }
+                               syncUnlock();
 #endif
 #endif
+                       }
+
+                       result = atr;
                }
                else
                {
                        SCARD_DEBUG_ERR("unavailable session");
                }
 
                }
                else
                {
                        SCARD_DEBUG_ERR("unavailable session");
                }
 
-               return atr;
+               return result;
        }
 
        int Session::getATR(getATRCallback callback, void *userData)
        }
 
        int Session::getATR(getATRCallback callback, void *userData)
@@ -123,19 +128,27 @@ namespace smartcard_service_api
 
                if (getReader()->isSecureElementPresent() == true)
                {
 
                if (getReader()->isSecureElementPresent() == true)
                {
-                       Message msg;
+                       if (atr.isEmpty() == true)
+                       {
+                               Message msg;
 
 
-                       /* request channel handle from server */
-                       msg.message = Message::MSG_REQUEST_GET_ATR;
-                       msg.param1 = (unsigned int)handle;
-                       msg.error = (unsigned int)context; /* using error to context */
-                       msg.caller = (void *)this;
-                       msg.callback = (void *)callback;
-                       msg.userParam = userData;
+                               /* request channel handle from server */
+                               msg.message = Message::MSG_REQUEST_GET_ATR;
+                               msg.param1 = (unsigned int)handle;
+                               msg.error = (unsigned int)context; /* using error to context */
+                               msg.caller = (void *)this;
+                               msg.callback = (void *)callback;
+                               msg.userParam = userData;
 
 
-                       if (ClientIPC::getInstance().sendMessage(&msg) == true)
+                               if (ClientIPC::getInstance().sendMessage(&msg) == true)
+                               {
+                                       result = 0;
+                               }
+                       }
+                       else
                        {
                        {
-                               result = 0;
+                               /* TODO : invoke callback directly */
+                               callback(atr.getBuffer(), atr.getLength(), 0, userData);
                        }
                }
                else
                        }
                }
                else
@@ -146,7 +159,7 @@ namespace smartcard_service_api
                return result;
        }
 
                return result;
        }
 
-       void Session::closeSync()
+       void Session::closeSync() throw (ErrorIO &, ErrorIllegalState &)
        {
                Message msg;
                int rv;
        {
                Message msg;
                int rv;
@@ -282,6 +295,7 @@ namespace smartcard_service_api
        }
 
        Channel *Session::openChannelSync(int id, ByteArray aid)
        }
 
        Channel *Session::openChannelSync(int id, ByteArray aid)
+               throw (ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                openedChannel = NULL;
 
        {
                openedChannel = NULL;
 
@@ -356,11 +370,13 @@ namespace smartcard_service_api
        }
 
        Channel *Session::openBasicChannelSync(ByteArray aid)
        }
 
        Channel *Session::openBasicChannelSync(ByteArray aid)
+               throw (ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openChannelSync(0, aid);
        }
 
        Channel *Session::openBasicChannelSync(unsigned char *aid, unsigned int length)
        {
                return openChannelSync(0, aid);
        }
 
        Channel *Session::openBasicChannelSync(unsigned char *aid, unsigned int length)
+               throw (ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openBasicChannelSync(ByteArray(aid, length));
        }
        {
                return openBasicChannelSync(ByteArray(aid, length));
        }
@@ -370,17 +386,20 @@ namespace smartcard_service_api
                return openChannel(0, aid, callback, userData);
        }
 
                return openChannel(0, aid, callback, userData);
        }
 
-       int Session::openBasicChannel(unsigned char *aid, unsigned int length, openChannelCallback callback, void *userData)
+       int Session::openBasicChannel(unsigned char *aid, unsigned int length,
+               openChannelCallback callback, void *userData)
        {
                return openBasicChannel(ByteArray(aid, length), callback, userData);
        }
 
        Channel *Session::openLogicalChannelSync(ByteArray aid)
        {
                return openBasicChannel(ByteArray(aid, length), callback, userData);
        }
 
        Channel *Session::openLogicalChannelSync(ByteArray aid)
+               throw (ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openChannelSync(1, aid);
        }
 
        Channel *Session::openLogicalChannelSync(unsigned char *aid, unsigned int length)
        {
                return openChannelSync(1, aid);
        }
 
        Channel *Session::openLogicalChannelSync(unsigned char *aid, unsigned int length)
+               throw (ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openLogicalChannelSync(ByteArray(aid, length));
        }
        {
                return openLogicalChannelSync(ByteArray(aid, length));
        }
@@ -390,7 +409,8 @@ namespace smartcard_service_api
                return openChannel(1, aid, callback, userData);
        }
 
                return openChannel(1, aid, callback, userData);
        }
 
-       int Session::openLogicalChannel(unsigned char *aid, unsigned int length, openChannelCallback callback, void *userData)
+       int Session::openLogicalChannel(unsigned char *aid, unsigned int length,
+               openChannelCallback callback, void *userData)
        {
                return openLogicalChannel(ByteArray(aid, length), callback, userData);
        }
        {
                return openLogicalChannel(ByteArray(aid, length), callback, userData);
        }
@@ -420,7 +440,8 @@ namespace smartcard_service_api
                                if (msg->param1 != 0)
                                {
                                        /* create new instance of channel */
                                if (msg->param1 != 0)
                                {
                                        /* create new instance of channel */
-                                       channel = new ClientChannel(session->context, session, msg->param2, msg->data, (void *)msg->param1);
+                                       channel = new ClientChannel(session->context,
+                                               session, msg->param2, msg->data, (void *)msg->param1);
                                        if (channel != NULL)
                                        {
                                                session->channels.push_back(channel);
                                        if (channel != NULL)
                                        {
                                                session->channels.push_back(channel);
@@ -529,7 +550,7 @@ namespace smartcard_service_api
                        }
                        break;
 
                        }
                        break;
 
-               default:
+               default :
                        SCARD_DEBUG("unknown message : %s", msg->toString());
                        break;
                }
                        SCARD_DEBUG("unknown message : %s", msg->toString());
                        break;
                }
@@ -558,7 +579,7 @@ EXTERN_API reader_h session_get_reader(session_h handle)
        reader_h reader = NULL;
 
        SESSION_EXTERN_BEGIN;
        reader_h reader = NULL;
 
        SESSION_EXTERN_BEGIN;
-       reader = session->getReader();
+               reader = session->getReader();
        SESSION_EXTERN_END;
 
        return reader;
        SESSION_EXTERN_END;
 
        return reader;
@@ -569,7 +590,7 @@ EXTERN_API int session_get_atr(session_h handle, session_get_atr_cb callback, vo
        int result = -1;
 
        SESSION_EXTERN_BEGIN;
        int result = -1;
 
        SESSION_EXTERN_BEGIN;
-       result = session->getATR((getATRCallback)callback, userData);
+               result = session->getATR((getATRCallback)callback, userData);
        SESSION_EXTERN_END;
 
        return result;
        SESSION_EXTERN_END;
 
        return result;
@@ -580,7 +601,7 @@ EXTERN_API int session_close(session_h handle, session_close_session_cb callback
        int result = -1;
 
        SESSION_EXTERN_BEGIN;
        int result = -1;
 
        SESSION_EXTERN_BEGIN;
-       result = session->close((closeSessionCallback)callback, userData);
+               result = session->close((closeSessionCallback)callback, userData);
        SESSION_EXTERN_END;
 
        return result;
        SESSION_EXTERN_END;
 
        return result;
@@ -591,7 +612,7 @@ EXTERN_API bool session_is_closed(session_h handle)
        bool result = false;
 
        SESSION_EXTERN_BEGIN;
        bool result = false;
 
        SESSION_EXTERN_BEGIN;
-       result = session->isClosed();
+               result = session->isClosed();
        SESSION_EXTERN_END;
 
        return result;
        SESSION_EXTERN_END;
 
        return result;
@@ -600,27 +621,29 @@ EXTERN_API bool session_is_closed(session_h handle)
 EXTERN_API void session_close_channels(session_h handle)
 {
        SESSION_EXTERN_BEGIN;
 EXTERN_API void session_close_channels(session_h handle)
 {
        SESSION_EXTERN_BEGIN;
-       session->closeChannels();
+               session->closeChannels();
        SESSION_EXTERN_END;
 }
 
        SESSION_EXTERN_END;
 }
 
-EXTERN_API int session_open_basic_channel(session_h handle, unsigned char *aid, unsigned int length, session_open_channel_cb callback, void *userData)
+EXTERN_API int session_open_basic_channel(session_h handle, unsigned char *aid,
+       unsigned int length, session_open_channel_cb callback, void *userData)
 {
        int result = -1;
 
        SESSION_EXTERN_BEGIN;
 {
        int result = -1;
 
        SESSION_EXTERN_BEGIN;
-       result = session->openBasicChannel(aid, length, (openChannelCallback)callback, userData);
+               result = session->openBasicChannel(aid, length, (openChannelCallback)callback, userData);
        SESSION_EXTERN_END;
 
        return result;
 }
 
        SESSION_EXTERN_END;
 
        return result;
 }
 
-EXTERN_API int session_open_logical_channel(session_h handle, unsigned char *aid, unsigned int length, session_open_channel_cb callback, void *userData)
+EXTERN_API int session_open_logical_channel(session_h handle, unsigned char *aid,
+       unsigned int length, session_open_channel_cb callback, void *userData)
 {
        int result = -1;
 
        SESSION_EXTERN_BEGIN;
 {
        int result = -1;
 
        SESSION_EXTERN_BEGIN;
-       result = session->openLogicalChannel(aid, length, (openChannelCallback)callback, userData);
+               result = session->openLogicalChannel(aid, length, (openChannelCallback)callback, userData);
        SESSION_EXTERN_END;
 
        return result;
        SESSION_EXTERN_END;
 
        return result;
@@ -631,7 +654,7 @@ EXTERN_API int session_get_channel_count(session_h handle, session_get_channel_c
        int result = -1;
 
        SESSION_EXTERN_BEGIN;
        int result = -1;
 
        SESSION_EXTERN_BEGIN;
-       result = session->getChannelCount((getChannelCountCallback)callback, userData);
+               result = session->getChannelCount((getChannelCountCallback)callback, userData);
        SESSION_EXTERN_END;
 
        return result;
        SESSION_EXTERN_END;
 
        return result;
@@ -639,9 +662,6 @@ EXTERN_API int session_get_channel_count(session_h handle, session_get_channel_c
 
 EXTERN_API void session_destroy_instance(session_h handle)
 {
 
 EXTERN_API void session_destroy_instance(session_h handle)
 {
-       SESSION_EXTERN_BEGIN;
-       delete session;
-       SESSION_EXTERN_END;
 }
 
 EXTERN_API int session_get_atr_sync(session_h handle, unsigned char **buffer, unsigned int *length)
 }
 
 EXTERN_API int session_get_atr_sync(session_h handle, unsigned char **buffer, unsigned int *length)
@@ -654,16 +674,16 @@ EXTERN_API int session_get_atr_sync(session_h handle, unsigned char **buffer, un
                return result;
 
        SESSION_EXTERN_BEGIN;
                return result;
 
        SESSION_EXTERN_BEGIN;
-       temp = session->getATRSync();
-       if (temp.getLength() > 0)
-       {
-               *length = temp.getLength();
-               *buffer = (unsigned char *)calloc(1, *length);
-               memcpy(*buffer, temp.getBuffer(), *length);
+               temp = session->getATRSync();
+               if (temp.getLength() > 0)
+               {
+                       *length = temp.getLength();
+                       *buffer = (unsigned char *)calloc(1, *length);
+                       memcpy(*buffer, temp.getBuffer(), *length);
 
 
-               result = 0;
-       }
-       SESSION_EXTERN_END;
+                       result = 0;
+               }
+               SESSION_EXTERN_END;
 #endif
 
        return result;
 #endif
 
        return result;
@@ -673,7 +693,7 @@ EXTERN_API void session_close_sync(session_h handle)
 {
 #ifdef CLIENT_IPC_THREAD
        SESSION_EXTERN_BEGIN;
 {
 #ifdef CLIENT_IPC_THREAD
        SESSION_EXTERN_BEGIN;
-       session->closeSync();
+               session->closeSync();
        SESSION_EXTERN_END;
 #endif
 }
        SESSION_EXTERN_END;
 #endif
 }
@@ -684,7 +704,7 @@ EXTERN_API channel_h session_open_basic_channel_sync(session_h handle, unsigned
 
 #ifdef CLIENT_IPC_THREAD
        SESSION_EXTERN_BEGIN;
 
 #ifdef CLIENT_IPC_THREAD
        SESSION_EXTERN_BEGIN;
-       result = session->openBasicChannelSync(aid, length);
+               result = session->openBasicChannelSync(aid, length);
        SESSION_EXTERN_END;
 #endif
 
        SESSION_EXTERN_END;
 #endif
 
@@ -697,7 +717,7 @@ EXTERN_API channel_h session_open_logical_channel_sync(session_h handle, unsigne
 
 #ifdef CLIENT_IPC_THREAD
        SESSION_EXTERN_BEGIN;
 
 #ifdef CLIENT_IPC_THREAD
        SESSION_EXTERN_BEGIN;
-       result = session->openLogicalChannelSync(aid, length);
+               result = session->openLogicalChannelSync(aid, length);
        SESSION_EXTERN_END;
 #endif
 
        SESSION_EXTERN_END;
 #endif
 
@@ -710,7 +730,7 @@ EXTERN_API unsigned int session_get_channel_count_sync(session_h handle)
 
 #ifdef CLIENT_IPC_THREAD
        SESSION_EXTERN_BEGIN;
 
 #ifdef CLIENT_IPC_THREAD
        SESSION_EXTERN_BEGIN;
-       result = session->getChannelCountSync();
+               result = session->getChannelCountSync();
        SESSION_EXTERN_END;
 #endif
 
        SESSION_EXTERN_END;
 #endif
 
index 53866c0..bbd5194 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef CLIENTCHANNEL_H_
 #define CLIENTCHANNEL_H_
 
 #ifndef CLIENTCHANNEL_H_
 #define CLIENTCHANNEL_H_
@@ -41,18 +40,22 @@ namespace smartcard_service_api
                int error;
                ByteArray response;
 
                int error;
                ByteArray response;
 
-               ClientChannel(void *context, Session *session, int channelNum, ByteArray selectResponse, void *handle);
+               ClientChannel(void *context, Session *session, int channelNum,
+                       ByteArray selectResponse, void *handle);
+               ~ClientChannel();
 
                static bool dispatcherCallback(void *message);
 
        public:
 
                static bool dispatcherCallback(void *message);
 
        public:
-               ~ClientChannel();
-
                int close(closeCallback callback, void *userParam);
                int close(closeCallback callback, void *userParam);
-               int transmit(ByteArray command, transmitCallback callback, void *userParam);
+               int transmit(ByteArray command, transmitCallback callback,
+                       void *userParam);
 
 
-               void closeSync();
-               int transmitSync(ByteArray command, ByteArray &result);
+               void closeSync()
+                       throw(ErrorIO &, ErrorIllegalState &);
+               int transmitSync(ByteArray command, ByteArray &result)
+                       throw(ErrorIO &, ErrorIllegalState &,
+                               ErrorIllegalParameter &, ErrorSecurity &);
 
                friend class ClientDispatcher;
                friend class Session;
 
                friend class ClientDispatcher;
                friend class Session;
@@ -71,14 +74,17 @@ bool channel_is_basic_channel(channel_h handle);
 bool channel_is_closed(channel_h handle);
 
 unsigned int channel_get_select_response_length(channel_h handle);
 bool channel_is_closed(channel_h handle);
 
 unsigned int channel_get_select_response_length(channel_h handle);
-bool channel_get_select_response(channel_h handle, unsigned char *buffer, unsigned int length);
+bool channel_get_select_response(channel_h handle, unsigned char *buffer,
+       unsigned int length);
 session_h channel_get_session(channel_h handle);
 session_h channel_get_session(channel_h handle);
-void channel_destroy_instance(channel_h handle);
+void channel_destroy_instance(channel_h handle) __attribute__((deprecated)) ;
 
 int channel_close(channel_h handle, channel_close_cb callback, void *userParam);
 
 int channel_close(channel_h handle, channel_close_cb callback, void *userParam);
-int channel_transmit(channel_h handle, unsigned char *command, unsigned int length, channel_transmit_cb callback, void *userParam);
+int channel_transmit(channel_h handle, unsigned char *command,
+       unsigned int length, channel_transmit_cb callback, void *userParam);
 void channel_close_sync(channel_h handle);
 void channel_close_sync(channel_h handle);
-int channel_transmit_sync(channel_h handle, unsigned char *command, unsigned int cmd_len, unsigned char **response, unsigned int *resp_len);
+int channel_transmit_sync(channel_h handle, unsigned char *command,
+       unsigned int cmd_len, unsigned char **response, unsigned int *resp_len);
 
 #ifdef __cplusplus
 }
 
 #ifdef __cplusplus
 }
index 54d306a..3305b28 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef CLIENTDISPATCHER_H_
 #define CLIENTDISPATCHER_H_
 
 #ifndef CLIENTDISPATCHER_H_
 #define CLIENTDISPATCHER_H_
index 354cd5d..4dbbc76 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef CLIENTIPC_H_
 #define CLIENTIPC_H_
 
 #ifndef CLIENTIPC_H_
 #define CLIENTIPC_H_
index 8916bce..d80d1ed 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef READER_H_
 #define READER_H_
 
 #ifndef READER_H_
 #define READER_H_
@@ -37,30 +36,29 @@ namespace smartcard_service_api
        private:
                void *context;
                void *handle;
        private:
                void *context;
                void *handle;
-               ByteArray packageCert;
                /* temporary data for sync function */
                int error;
                Session *openedSession;
 
                Reader(void *context, const char *name, void *handle);
                /* temporary data for sync function */
                int error;
                Session *openedSession;
 
                Reader(void *context, const char *name, void *handle);
+               ~Reader();
 
                void unavailable();
 
                static bool dispatcherCallback(void *message);
 
                void unavailable();
 
                static bool dispatcherCallback(void *message);
-               void getPackageCert();
 
        public:
 
        public:
-               ~Reader();
-
-               void closeSessions();
+               void closeSessions()
+                       throw(ErrorIO &, ErrorIllegalState &);
 
                int openSession(openSessionCallback callback, void *userData);
 
                int openSession(openSessionCallback callback, void *userData);
-               SessionHelper *openSessionSync();
+               SessionHelper *openSessionSync()
+                       throw(ErrorIO &, ErrorIllegalState &,
+                               ErrorIllegalParameter &, ErrorSecurity &);
 
                friend class SEService;
                friend class ClientDispatcher;
        };
 
                friend class SEService;
                friend class ClientDispatcher;
        };
-
 } /* namespace smartcard_service_api */
 #endif /* __cplusplus */
 
 } /* namespace smartcard_service_api */
 #endif /* __cplusplus */
 
@@ -73,10 +71,11 @@ extern "C"
 const char *reader_get_name(reader_h handle);
 se_service_h reader_get_se_service(reader_h handle);
 bool reader_is_secure_element_present(reader_h handle);
 const char *reader_get_name(reader_h handle);
 se_service_h reader_get_se_service(reader_h handle);
 bool reader_is_secure_element_present(reader_h handle);
-int reader_open_session(reader_h handle, reader_open_session_cb callback, void *userData);
+int reader_open_session(reader_h handle, reader_open_session_cb callback,
+       void *userData);
 session_h reader_open_session_sync(reader_h handle);
 void reader_close_sessions(reader_h handle);
 session_h reader_open_session_sync(reader_h handle);
 void reader_close_sessions(reader_h handle);
-void reader_destroy_instance(reader_h handle);
+__attribute__((deprecated)) void reader_destroy_instance(reader_h handle);
 
 #ifdef __cplusplus
 }
 
 #ifdef __cplusplus
 }
index 18bdd35..0070fe3 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SESERVICE_H_
 #define SESERVICE_H_
 
 #ifndef SESERVICE_H_
 #define SESERVICE_H_
@@ -49,23 +48,32 @@ namespace smartcard_service_api
                static bool dispatcherCallback(void *message);
                bool parseReaderInformation(unsigned int count, ByteArray data);
 
                static bool dispatcherCallback(void *message);
                bool parseReaderInformation(unsigned int count, ByteArray data);
 
-               bool _initialize();
-
-               bool initialize(void *context, serviceConnected handler);
-               bool initialize(void *context, SEServiceListener *listener);
-               SEService *initializeSync(void *context, serviceConnected handler);
+               bool _initialize()
+                       throw(ErrorIO &);
+               bool initialize(void *context, serviceConnected handler)
+                       throw(ErrorIO &, ErrorIllegalParameter &);
+               bool initialize(void *context, SEServiceListener *listener)
+                       throw(ErrorIO &, ErrorIllegalParameter &);
+               SEService *initializeSync(void *context, serviceConnected handler)
+                       throw(ErrorIO &, ErrorIllegalParameter &);
 
        public:
 
        public:
-               SEService(void *user_data, serviceConnected handler);
-               SEService(void *user_data, SEServiceListener *listener);
+               SEService(void *user_data, serviceConnected handler)
+                       throw(ErrorIO &, ErrorIllegalParameter &);
+               SEService(void *user_data, SEServiceListener *listener)
+                       throw(ErrorIO &, ErrorIllegalParameter &);
                ~SEService();
 
                ~SEService();
 
+               static SEService *createInstance(void *user_data, SEServiceListener *listener)
+                       throw(ErrorIO &, ErrorIllegalParameter &);
+               static SEService *createInstance(void *user_data, serviceConnected handler)
+                       throw(ErrorIO &, ErrorIllegalParameter &);
+
                void shutdown();
                void shutdownSync();
 
                friend class ClientDispatcher;
        };
                void shutdown();
                void shutdownSync();
 
                friend class ClientDispatcher;
        };
-
 } /* namespace smartcard_service_api */
 #endif /* __cplusplus */
 
 } /* namespace smartcard_service_api */
 #endif /* __cplusplus */
 
@@ -76,7 +84,8 @@ extern "C"
 #endif /* __cplusplus */
 
 se_service_h se_service_create_instance(void *user_data, se_service_connected_cb callback);
 #endif /* __cplusplus */
 
 se_service_h se_service_create_instance(void *user_data, se_service_connected_cb callback);
-se_service_h se_service_create_instance_with_event_callback(void *user_data, se_service_connected_cb connected, se_service_event_cb event, se_sesrvice_error_cb error);
+se_service_h se_service_create_instance_with_event_callback(void *user_data,
+       se_service_connected_cb connected, se_service_event_cb event, se_sesrvice_error_cb error);
 int se_service_get_readers_count(se_service_h handle);
 bool se_service_get_readers(se_service_h handle, reader_h *readers, int *count);
 bool se_service_is_connected(se_service_h handle);
 int se_service_get_readers_count(se_service_h handle);
 bool se_service_get_readers(se_service_h handle, reader_h *readers, int *count);
 bool se_service_is_connected(se_service_h handle);
index 1b8d4ea..9cfc01b 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SESERVICELISTENER_H_
 #define SESERVICELISTENER_H_
 
 #ifndef SESERVICELISTENER_H_
 #define SESERVICELISTENER_H_
@@ -30,10 +30,13 @@ namespace smartcard_service_api
        class SEServiceListener
        {
        public:
        class SEServiceListener
        {
        public:
-               virtual void serviceConnected(SEServiceHelper *service, void *context) = 0;
-               virtual void eventHandler(SEServiceHelper *service, char *seName, int event, void *context) = 0;
-               virtual void errorHandler(SEServiceHelper *service, int error, void *context) = 0;
+               virtual void serviceConnected(SEServiceHelper *service,
+                       void *context) = 0;
+               virtual void eventHandler(SEServiceHelper *service,
+                       char *seName, int event, void *context) = 0;
+               virtual void errorHandler(SEServiceHelper *service, int error,
+                       void *context) = 0;
        };
        };
-
 } /* namespace open_mobile_api */
 } /* namespace open_mobile_api */
+
 #endif /* SESERVICELISTENER_H_ */
 #endif /* SESERVICELISTENER_H_ */
index e4ec77f..ad91ce8 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SESSION_H_
 #define SESSION_H_
 
 #ifndef SESSION_H_
 #define SESSION_H_
@@ -44,16 +43,17 @@ namespace smartcard_service_api
                unsigned int channelCount;
 
                Session(void *context, Reader *reader, void *handle);
                unsigned int channelCount;
 
                Session(void *context, Reader *reader, void *handle);
+               ~Session();
 
                int openChannel(int id, ByteArray aid, openChannelCallback callback, void *userData);
                static bool dispatcherCallback(void *message);
 
 
                int openChannel(int id, ByteArray aid, openChannelCallback callback, void *userData);
                static bool dispatcherCallback(void *message);
 
-               Channel *openChannelSync(int id, ByteArray aid);
+               Channel *openChannelSync(int id, ByteArray aid)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
 
        public:
 
        public:
-               ~Session();
-
-               void closeChannels();
+               void closeChannels()
+                       throw(ErrorIO &, ErrorIllegalState &);
 
                int getATR(getATRCallback callback, void *userData);
                int close(closeSessionCallback callback, void *userData);
 
                int getATR(getATRCallback callback, void *userData);
                int close(closeSessionCallback callback, void *userData);
@@ -64,13 +64,24 @@ namespace smartcard_service_api
                int openLogicalChannel(unsigned char *aid, unsigned int length, openChannelCallback callback, void *userData);
                int getChannelCount(getChannelCountCallback callback, void * userData);
 
                int openLogicalChannel(unsigned char *aid, unsigned int length, openChannelCallback callback, void *userData);
                int getChannelCount(getChannelCountCallback callback, void * userData);
 
-               ByteArray getATRSync();
-               void closeSync();
+               ByteArray getATRSync()
+                       throw(ErrorIO &, ErrorIllegalState &);
+
+               void closeSync()
+                       throw(ErrorIO &, ErrorIllegalState &);
+
+               Channel *openBasicChannelSync(ByteArray aid)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+
+               Channel *openBasicChannelSync(unsigned char *aid, unsigned int length)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+
+               Channel *openLogicalChannelSync(ByteArray aid)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+
+               Channel *openLogicalChannelSync(unsigned char *aid, unsigned int length)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
 
 
-               Channel *openBasicChannelSync(ByteArray aid);
-               Channel *openBasicChannelSync(unsigned char *aid, unsigned int length);
-               Channel *openLogicalChannelSync(ByteArray aid);
-               Channel *openLogicalChannelSync(unsigned char *aid, unsigned int length);
                unsigned int getChannelCountSync();
 
                friend class ClientDispatcher;
                unsigned int getChannelCountSync();
 
                friend class ClientDispatcher;
@@ -88,14 +99,16 @@ extern "C"
 
 reader_h session_get_reader(session_h handle);
 bool session_is_closed(session_h handle);
 
 reader_h session_get_reader(session_h handle);
 bool session_is_closed(session_h handle);
-void session_destroy_instance(session_h handle);
+__attribute__((deprecated)) void session_destroy_instance(session_h handle);
 void session_close_channels(session_h handle);
 
 int session_get_atr(session_h handle, session_get_atr_cb callback, void *userData);
 int session_close(session_h handle, session_close_session_cb callback, void *userData);
 
 void session_close_channels(session_h handle);
 
 int session_get_atr(session_h handle, session_get_atr_cb callback, void *userData);
 int session_close(session_h handle, session_close_session_cb callback, void *userData);
 
-int session_open_basic_channel(session_h handle, unsigned char *aid, unsigned int length, session_open_channel_cb callback, void *userData);
-int session_open_logical_channel(session_h handle, unsigned char *aid, unsigned int length, session_open_channel_cb callback, void *userData);
+int session_open_basic_channel(session_h handle, unsigned char *aid,
+       unsigned int length, session_open_channel_cb callback, void *userData);
+int session_open_logical_channel(session_h handle, unsigned char *aid,
+       unsigned int length, session_open_channel_cb callback, void *userData);
 int session_get_channel_count(session_h handle, session_get_channel_count_cb callback, void * userData);
 
 int session_get_atr_sync(session_h handle, unsigned char **buffer, unsigned int *length);
 int session_get_channel_count(session_h handle, session_get_channel_count_cb callback, void * userData);
 
 int session_get_atr_sync(session_h handle, unsigned char **buffer, unsigned int *length);
diff --git a/client/include/smartcard-service.h b/client/include/smartcard-service.h
new file mode 100644 (file)
index 0000000..a79163d
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SMARTCARD_SERVICE_H_
+#define SMARTCARD_SERVICE_H_
+
+#include "smartcard-types.h"
+#include "Exception.h"
+#include "SEService.h"
+#include "Reader.h"
+#include "Session.h"
+#include "ClientChannel.h"
+
+#endif /* SMARTCARD_SERVICE_H_ */
index 09c0883..f94bfdd 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -29,6 +28,7 @@ namespace smartcard_service_api
 {
        /* ResponseHelper class */
        ResponseHelper::ResponseHelper()
 {
        /* ResponseHelper class */
        ResponseHelper::ResponseHelper()
+               : status(0)
        {
        }
 
        {
        }
 
@@ -58,7 +58,8 @@ namespace smartcard_service_api
 
                        if (response.getLength() > 2)
                        {
 
                        if (response.getLength() > 2)
                        {
-                               dataField.setBuffer(response.getBuffer(), response.getLength() - 2);
+                               dataField.setBuffer(response.getBuffer(),
+                                       response.getLength() - 2);
                        }
 
                        result = true;
                        }
 
                        result = true;
@@ -69,17 +70,18 @@ namespace smartcard_service_api
 
        int ResponseHelper::parseStatusWord(unsigned char *sw)
        {
 
        int ResponseHelper::parseStatusWord(unsigned char *sw)
        {
-               int result = 0;
+               int result = sw[0] << 8 | sw[1];
 
                switch (sw[0])
                {
                /* Normal processing */
                case (unsigned char)0x90 : /* SW2:00, No further qualification */
 
                switch (sw[0])
                {
                /* Normal processing */
                case (unsigned char)0x90 : /* SW2:00, No further qualification */
-                       break;
-
                case (unsigned char)0x91 : /* extra information */
                case (unsigned char)0x91 : /* extra information */
+               case (unsigned char)0x92 : /* extra information */
+                       result = 0;
                        break;
 
                        break;
 
+#if 0
                case (unsigned char)0x61 : /* SW2 encodes the number of data bytes still available */
                        break;
 
                case (unsigned char)0x61 : /* SW2 encodes the number of data bytes still available */
                        break;
 
@@ -139,9 +141,9 @@ namespace smartcard_service_api
                case (unsigned char)0x6F : /* SW2:00, No precise diagnosis */
                        result = -1;
                        break;
                case (unsigned char)0x6F : /* SW2:00, No precise diagnosis */
                        result = -1;
                        break;
-
+#endif
                default :
                default :
-                       result = -1;
+                       result *= -1;
                        break;
                }
 
                        break;
                }
 
@@ -204,7 +206,8 @@ namespace smartcard_service_api
        {
        }
 
        {
        }
 
-       bool APDUCommand::setCommand(unsigned char cla, unsigned char ins, unsigned char p1, unsigned char p2, ByteArray commandData, unsigned int maxResponseSize)
+       bool APDUCommand::setCommand(unsigned char cla, unsigned char ins, unsigned char p1,
+               unsigned char p2, ByteArray commandData, unsigned int maxResponseSize)
        {
                setCLA(cla);
                setINS(ins);
        {
                setCLA(cla);
                setINS(ins);
@@ -259,12 +262,25 @@ namespace smartcard_service_api
                {
                        if (isExtendedLength)
                        {
                {
                        if (isExtendedLength)
                        {
-                               /* TODO */
+                               unsigned int temp;
+
+                               temp = command.getAt(offset) << 8;
+                               temp |= command.getAt(offset + 1);
+
+                               if (temp == 0)
+                                       setMaxResponseSize(APDUCommand::LE_MAX);
+                               else
+                                       setMaxResponseSize(temp);
+
                                offset += 2;
                        }
                        else
                        {
                                offset += 2;
                        }
                        else
                        {
-                               setMaxResponseSize(command.getAt(offset));
+                               if (command.getAt(offset) == 0)
+                                       setMaxResponseSize(APDUCommand::LE_MAX);
+                               else
+                                       setMaxResponseSize(command.getAt(offset));
+
                                offset += 1;
                        }
                }
                                offset += 1;
                        }
                }
@@ -404,7 +420,7 @@ namespace smartcard_service_api
                this->maxResponseSize = maxResponseSize;
        }
 
                this->maxResponseSize = maxResponseSize;
        }
 
-       unsigned int APDUCommand::setMaxResponseSize()
+       unsigned int APDUCommand::getMaxResponseSize()
        {
                return maxResponseSize;
        }
        {
                return maxResponseSize;
        }
@@ -464,7 +480,7 @@ namespace smartcard_service_api
                        }
                        else
                        {
                        }
                        else
                        {
-                               if (maxResponseSize != 256)
+                               if (maxResponseSize < 256)
                                        le[0] = maxResponseSize & 0x000000FF;
 
                                le_len = 1;
                                        le[0] = maxResponseSize & 0x000000FF;
 
                                le_len = 1;
@@ -513,7 +529,7 @@ namespace smartcard_service_api
                switch (command)
                {
                case COMMAND_OPEN_LOGICAL_CHANNEL :
                switch (command)
                {
                case COMMAND_OPEN_LOGICAL_CHANNEL :
-                       apdu.setCommand(0, APDUCommand::INS_MANAGE_CHANNEL, 0, 0, ByteArray::EMPTY, 1);
+                       apdu.setCommand(0, APDUCommand::INS_MANAGE_CHANNEL, 0, 0, ByteArray::EMPTY, APDUCommand::LE_MAX);
                        apdu.getBuffer(result);
                        break;
 
                        apdu.getBuffer(result);
                        break;
 
index 7075ae2..703d0de 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
index e4a13be..9ed93f1 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
index 8e825c2..745800f 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
index 4b36681..7b28e5c 100644 (file)
@@ -15,7 +15,7 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SRCS)
 #MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
 INCLUDE(FindPkgConfig)
 #MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs_common REQUIRED dlog glib-2.0 aul libssl pkgmgr)
+pkg_check_modules(pkgs_common REQUIRED dlog glib-2.0 aul libssl pkgmgr pkgmgr-info)
 
 MESSAGE("${LIB_NAME} ld flag : ${pkgs_common_LDFLAGS}")
 
 
 MESSAGE("${LIB_NAME} ld flag : ${pkgs_common_LDFLAGS}")
 
@@ -59,6 +59,7 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_common_LDFLAGS})
 
 SET(EXPORT_HEADER 
        include/Debug.h
 
 SET(EXPORT_HEADER 
        include/Debug.h
+       include/Exception.h
        include/ByteArray.h
        include/Lock.h
        include/Synchronous.h   
        include/ByteArray.h
        include/Lock.h
        include/Synchronous.h   
index 40bd670..a4b5510 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
diff --git a/common/EFDIR.cpp b/common/EFDIR.cpp
new file mode 100644 (file)
index 0000000..16dfc54
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* standard library header */
+#include <stdio.h>
+
+/* SLP library header */
+
+/* local header */
+#include "Debug.h"
+#include "EFDIR.h"
+#include "APDUHelper.h"
+#include "SimpleTLV.h"
+
+namespace smartcard_service_api
+{
+       EFDIR::EFDIR(Channel *channel) : FileObject(channel)
+       {
+               unsigned char path[] = { 0x2f, 0x00 };
+               ByteArray dirPath(ARRAY_AND_SIZE(path));
+               int ret;
+
+               ret = select(dirPath, false);
+               if (ret == FileObject::SUCCESS)
+               {
+                       SCARD_DEBUG("response : %s", selectResponse.toString());
+               }
+               else
+               {
+                       SCARD_DEBUG_ERR("EFDIR select failed, [%d]", ret);
+               }
+       }
+
+       EFDIR::EFDIR(Channel *channel, ByteArray selectResponse)
+               : FileObject(channel, selectResponse)
+       {
+       }
+
+       EFDIR::~EFDIR()
+       {
+       }
+
+       ByteArray EFDIR::parseRecord(Record &record, ByteArray &aid)
+       {
+               bool matched = false;
+               ByteArray result;
+               SimpleTLV tlv(record.getData());
+
+               if (tlv.decodeTLV() == true && tlv.getTag() == 0x61)
+               {
+                       tlv.enterToValueTLV();
+                       while (tlv.decodeTLV() == true)
+                       {
+                               switch (tlv.getTag())
+                               {
+                               case 0x4F : /* aid */
+                                       if (tlv.getValue() == aid)
+                                               matched = true;
+                                       break;
+                               case 0x50 : /* label */
+                                       break;
+                               case 0x51 : /* path */
+                                       result = tlv.getValue();
+                                       break;
+                               case 0x53 : /* ddo */
+                                       break;
+                               }
+                       }
+                       tlv.returnToParentTLV();
+
+                       if (matched == true)
+                       {
+                               SCARD_DEBUG("Found!! : path %s", result.toString());
+                       }
+                       else
+                       {
+                               result.setBuffer(NULL, 0);
+                       }
+               }
+
+               return result;
+       }
+
+       ByteArray EFDIR::getPathByAID(ByteArray &aid)
+       {
+               ByteArray result;
+               Record record;
+               unsigned int id;
+               int status = 0;
+
+               for (id = 1; status >= 0; id++)
+               {
+                       status = readRecord(0, id, record);
+                       if (status >= 0)
+                       {
+                               result = parseRecord(record, aid);
+                               if (result.getLength() > 0)
+                                       break;
+                       }
+               }
+
+               return result;
+       }
+} /* namespace smartcard_service_api */
diff --git a/common/Exception.cpp b/common/Exception.cpp
new file mode 100644 (file)
index 0000000..53a6b0e
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Exception.h"
+
+namespace smartcard_service_api
+{
+} /* namespace smartcard_service_api */
index 214f75e..1771dea 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
index 51c8c38..e93e459 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
 
 namespace smartcard_service_api
 {
 
 namespace smartcard_service_api
 {
-       FileObject::FileObject(Channel *channel):ProviderHelper(channel)
+       FileObject::FileObject(Channel *channel)
+               : ProviderHelper(channel)
        {
                opened = false;
        }
 
        {
                opened = false;
        }
 
-       FileObject::FileObject(Channel *channel, ByteArray selectResponse):ProviderHelper(channel)
+       FileObject::FileObject(Channel *channel, ByteArray selectResponse)
+               : ProviderHelper(channel)
        {
                opened = false;
                setSelectResponse(selectResponse);
        {
                opened = false;
                setSelectResponse(selectResponse);
@@ -40,6 +41,13 @@ namespace smartcard_service_api
 
        FileObject::~FileObject()
        {
 
        FileObject::~FileObject()
        {
+               close();
+       }
+
+       void FileObject::close()
+       {
+               opened = false;
+               selectResponse.releaseBuffer();
        }
 
        bool FileObject::setSelectResponse(ByteArray &response)
        }
 
        bool FileObject::setSelectResponse(ByteArray &response)
@@ -64,7 +72,8 @@ namespace smartcard_service_api
                        }
                        else
                        {
                        }
                        else
                        {
-                               SCARD_DEBUG_ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
+                               SCARD_DEBUG_ERR("status word [%d][ %02X %02X ]",
+                                       resp.getStatus(), resp.getSW1(), resp.getSW2());
                        }
                }
                else
                        }
                }
                else
@@ -87,23 +96,34 @@ namespace smartcard_service_api
                        return ret;
                }
 
                        return ret;
                }
 
-               opened = false;
+               close();
 
                ret = channel->transmitSync(command, result);
                if (ret == 0)
                {
 
                ret = channel->transmitSync(command, result);
                if (ret == 0)
                {
-                       if (setSelectResponse(result) == true)
+                       ResponseHelper resp(result);
+
+                       if (resp.getStatus() == 0)
                        {
                        {
-                               ret = SUCCESS;
+                               if (setSelectResponse(result) == true)
+                               {
+                                       opened = true;
+                                       ret = SUCCESS;
+                               }
+                               else
+                               {
+                                       ret = ERROR_ILLEGAL_STATE;
+                               }
                        }
                        }
-                       else
+                       else if (resp.getStatus() == ResponseHelper::ERROR_FILE_NOT_FOUND)
                        {
                        {
-                               ret = ERROR_ILLEGAL_STATE;
+                               ret = ResponseHelper::ERROR_FILE_NOT_FOUND;
                        }
                }
                else
                {
                        }
                }
                else
                {
-                       SCARD_DEBUG_ERR("select apdu is failed, rv [%d], length [%d]", ret, result.getLength());
+                       SCARD_DEBUG_ERR("select apdu is failed, rv [%d], length [%d]",
+                               ret, result.getLength());
 
                        ret = ERROR_ILLEGAL_STATE;
                }
 
                        ret = ERROR_ILLEGAL_STATE;
                }
@@ -118,7 +138,6 @@ namespace smartcard_service_api
 
                /* make apdu command */
                command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_DF_NAME, 0, aid);
 
                /* make apdu command */
                command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_DF_NAME, 0, aid);
-               SCARD_DEBUG("command : %s", command.toString());
 
                ret = _select(command);
 
 
                ret = _select(command);
 
@@ -137,9 +156,16 @@ namespace smartcard_service_api
                }
                else
                {
                }
                else
                {
-                       command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_PATH, 0, path);
+                       ByteArray temp(path);
+
+                       if (path.getLength() > 2 && path[0] == 0x3f && path[1] == 0x00) /* check MF */
+                       {
+                               /* remove MF from path */
+                               temp.setBuffer(path.getBuffer(2), path.getLength() - 2);
+                       }
+
+                       command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_PATH, 0, temp);
                }
                }
-               SCARD_DEBUG("command : %s", command.toString());
 
                ret = _select(command);
 
 
                ret = _select(command);
 
@@ -153,7 +179,6 @@ namespace smartcard_service_api
 
                /* make apdu command */
                command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_ID, 0, fidData);
 
                /* make apdu command */
                command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_ID, 0, fidData);
-               SCARD_DEBUG("command : %s", command.toString());
 
                ret = _select(command);
 
 
                ret = _select(command);
 
@@ -167,7 +192,6 @@ namespace smartcard_service_api
 
                /* make apdu command */
                command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_PARENT_DF, 0, ByteArray::EMPTY);
 
                /* make apdu command */
                command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_PARENT_DF, 0, ByteArray::EMPTY);
-               SCARD_DEBUG("command : %s", command.toString());
 
                ret = _select(command);
 
 
                ret = _select(command);
 
@@ -190,22 +214,20 @@ namespace smartcard_service_api
                APDUCommand apdu;
                int ret;
 
                APDUCommand apdu;
                int ret;
 
-               apdu.setCommand(0, APDUCommand::INS_READ_RECORD, recordId, 4, ByteArray::EMPTY, 0);
+               apdu.setCommand(0, APDUCommand::INS_READ_RECORD, recordId, 4, ByteArray::EMPTY, APDUCommand::LE_MAX);
                apdu.getBuffer(command);
                apdu.getBuffer(command);
-               SCARD_DEBUG("command : %s", command.toString());
 
                ret = channel->transmitSync(command, response);
                if (ret == 0 && response.getLength() >= 2)
                {
                        ResponseHelper resp(response);
 
 
                ret = channel->transmitSync(command, response);
                if (ret == 0 && response.getLength() >= 2)
                {
                        ResponseHelper resp(response);
 
-                       if (resp.getStatus() == 0)
+                       ret = resp.getStatus();
+                       if (ret == 0)
                        {
                                SCARD_DEBUG("response [%d] : %s", response.getLength(), response.toString());
 
                        {
                                SCARD_DEBUG("response [%d] : %s", response.getLength(), response.toString());
 
-//                             result = resp.getDataField();
-
-                               ret = SUCCESS;
+                               result = Record(recordId, resp.getDataField());
                        }
                        else
                        {
                        }
                        else
                        {
@@ -238,7 +260,6 @@ namespace smartcard_service_api
 
                apdu.setCommand(0, APDUCommand::INS_READ_BINARY, offset, 0, ByteArray::EMPTY, length);
                apdu.getBuffer(command);
 
                apdu.setCommand(0, APDUCommand::INS_READ_BINARY, offset, 0, ByteArray::EMPTY, length);
                apdu.getBuffer(command);
-               SCARD_DEBUG("command : %s", command.toString());
 
                ret = channel->transmitSync(command, response);
                if (ret == 0 && response.getLength() >= 2)
 
                ret = channel->transmitSync(command, response);
                if (ret == 0 && response.getLength() >= 2)
@@ -274,7 +295,6 @@ namespace smartcard_service_api
 
                apdu.setCommand(0, APDUCommand::INS_WRITE_BINARY, offset, 0, data, 0);
                apdu.getBuffer(command);
 
                apdu.setCommand(0, APDUCommand::INS_WRITE_BINARY, offset, 0, data, 0);
                apdu.getBuffer(command);
-               SCARD_DEBUG("command : %s", command.toString());
 
                ret = channel->transmitSync(command, response);
                if (ret == 0 && response.getLength() >= 2)
 
                ret = channel->transmitSync(command, response);
                if (ret == 0 && response.getLength() >= 2)
@@ -299,5 +319,4 @@ namespace smartcard_service_api
 
                return ret;
        }
 
                return ret;
        }
-
 } /* namespace smartcard_service_api */
 } /* namespace smartcard_service_api */
index ed8f041..a6eb0f7 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
index 3302fcb..708575a 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -160,7 +159,10 @@ namespace smartcard_service_api
                }
 
 #ifdef SECURITY_SERVER
                }
 
 #ifdef SECURITY_SERVER
-               gid = security_server_get_gid(NET_NFC_MANAGER_OBJECT);
+               int gid, cookies_size;
+               char *cookies;
+
+               gid = security_server_get_gid("smartcard-service");
                if(gid == 0)
                {
                        SCARD_DEBUG("get gid from security server is failed. this object is not allowed by security server");
                if(gid == 0)
                {
                        SCARD_DEBUG("get gid from security server is failed. this object is not allowed by security server");
@@ -216,6 +218,16 @@ ERROR :
                                }
                        }
                }
                                }
                        }
                }
+               else if (errno == EINTR)
+               {
+                       SCARD_DEBUG_ERR("epoll_wait interrupted");
+               }
+               else
+               {
+                       char buffer[1024];
+
+                       SCARD_DEBUG_ERR("epoll_wait failed, errno [%d], %s", errno, strerror_r(errno, buffer, sizeof(buffer)));
+               }
 #else
                if (select(ipcSocket + 1, &fdSetRead, NULL, NULL, NULL) > 0)
                {
 #else
                if (select(ipcSocket + 1, &fdSetRead, NULL, NULL, NULL) > 0)
                {
@@ -296,8 +308,7 @@ ERROR :
                        }
                        else
                        {
                        }
                        else
                        {
-                               helper->handleInvalidSocketCondition(NULL, G_IO_NVAL);
-                               condition = false;
+                               /* skip other error case */
                        }
                }
 
                        }
                }
 
@@ -313,6 +324,7 @@ ERROR :
                GIOCondition condition = (GIOCondition)(G_IO_ERR | G_IO_HUP | G_IO_IN);
 #endif
                int result = 0;
                GIOCondition condition = (GIOCondition)(G_IO_ERR | G_IO_HUP | G_IO_IN);
 #endif
                int result = 0;
+               char err[200] = { 0, };
 
                SCARD_BEGIN();
 
 
                SCARD_BEGIN();
 
@@ -329,7 +341,8 @@ ERROR :
                ipcSocket = socket(AF_UNIX, SOCK_STREAM, 0);
                if (ipcSocket == -1)
                {
                ipcSocket = socket(AF_UNIX, SOCK_STREAM, 0);
                if (ipcSocket == -1)
                {
-                       SCARD_DEBUG_ERR("get socket is failed");
+                       SCARD_DEBUG_ERR("get socket is failed [%d, %s]",
+                               errno, strerror_r(errno, err, sizeof(err)));
                        goto ERROR;
                }
 
                        goto ERROR;
                }
 
@@ -344,7 +357,8 @@ ERROR :
 
                if ((result = connect(ipcSocket, (struct sockaddr *)&saddrun_rv, len_saddr)) < 0)
                {
 
                if ((result = connect(ipcSocket, (struct sockaddr *)&saddrun_rv, len_saddr)) < 0)
                {
-                       SCARD_DEBUG_ERR("connect failed [%d]", result);
+                       SCARD_DEBUG_ERR("connect failed [%d, %s]",
+                               errno, strerror_r(errno, err, sizeof(err)));
                        goto ERROR;
                }
 
                        goto ERROR;
                }
 
@@ -352,7 +366,8 @@ ERROR :
 #ifdef USE_IPC_EPOLL
                if((fdPoll = epoll_create1(EPOLL_CLOEXEC)) == -1)
                {
 #ifdef USE_IPC_EPOLL
                if((fdPoll = epoll_create1(EPOLL_CLOEXEC)) == -1)
                {
-                       SCARD_DEBUG_ERR("epoll_create1 failed");
+                       SCARD_DEBUG_ERR("epoll_create1 failed [%d, %s]",
+                               errno, strerror_r(errno, err, sizeof(err)));
                        goto ERROR;
                }
 
                        goto ERROR;
                }
 
@@ -509,7 +524,8 @@ ERROR :
                stream = msg->serialize();
                length = stream.getLength();
 
                stream = msg->serialize();
                length = stream.getLength();
 
-               SCARD_DEBUG(">>>[SEND]>>> socket [%d], msg [%d], length [%d]", socket, msg->message, stream.getLength());
+               SCARD_DEBUG(">>>[SEND]>>> socket [%d], msg [%d], length [%d]",
+                       socket, msg->message, stream.getLength());
 
                return sendMessage(socket, stream);
        }
 
                return sendMessage(socket, stream);
        }
index abe8d2f..425376a 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
index 5f9cae5..a9b815e 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
index 6e3bda1..455ce16 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include "NumberStream.h"
 
 
 #include "NumberStream.h"
 
index 4a94c9f..46236d7 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
 
 /* local header */
 #include "Debug.h"
 
 /* local header */
 #include "Debug.h"
+#include "APDUHelper.h"
+#include "EFDIR.h"
 #include "PKCS15.h"
 
 namespace smartcard_service_api
 {
 #include "PKCS15.h"
 
 namespace smartcard_service_api
 {
-       static unsigned char aid[] = { 0xA0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35 };
+       static unsigned char aid[] = { 0xA0, 0x00, 0x00, 0x00, 0x63, 0x50,
+               0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35 };
        ByteArray PKCS15::PKCS15_AID(ARRAY_AND_SIZE(aid));
 
        ByteArray PKCS15::PKCS15_AID(ARRAY_AND_SIZE(aid));
 
-       PKCS15::PKCS15(Channel *channel):PKCS15Object(channel), odf(NULL)
+       PKCS15::PKCS15(Channel *channel)
+               : PKCS15Object(channel), odf(NULL)
        {
        {
-               int ret = 0;
+               int ret;
 
 
-               if ((ret = select(PKCS15::PKCS15_AID)) == 0)
+               ret = select(PKCS15::PKCS15_AID);
+               if (ret == FileObject::SUCCESS)
                {
                        SCARD_DEBUG("response : %s", selectResponse.toString());
                }
                {
                        SCARD_DEBUG("response : %s", selectResponse.toString());
                }
+               else if (ret == ResponseHelper::ERROR_FILE_NOT_FOUND)
+               {
+                       SCARD_DEBUG_ERR("PKCS15 AID not found, search in EF DIR");
+
+                       if (selectFromEFDIR() == true)
+                       {
+                               SCARD_DEBUG("response : %s", selectResponse.toString());
+                       }
+                       else
+                       {
+                               SCARD_DEBUG_ERR("PKCS15 select failed, [%d]", ret);
+                       }
+               }
                else
                {
                else
                {
-                       SCARD_DEBUG_ERR("select failed, [%d]", ret);
+                       SCARD_DEBUG_ERR("PKCS15 select failed, [%d]", ret);
                }
        }
 
                }
        }
 
-       PKCS15::PKCS15(Channel *channel, ByteArray selectResponse):PKCS15Object(channel, selectResponse), odf(NULL)
+       PKCS15::PKCS15(Channel *channel, ByteArray selectResponse)
+               : PKCS15Object(channel, selectResponse), odf(NULL)
        {
        }
 
        {
        }
 
@@ -55,6 +73,35 @@ namespace smartcard_service_api
                }
        }
 
                }
        }
 
+       bool PKCS15::selectFromEFDIR()
+       {
+               bool result = false;
+               ByteArray path;
+               EFDIR dir(channel);
+
+               path = dir.getPathByAID(PKCS15_AID);
+               if (path.getLength() > 0)
+               {
+                       int ret;
+
+                       ret = select(path, false);
+                       if (ret == FileObject::SUCCESS)
+                       {
+                               result = true;
+                       }
+                       else
+                       {
+                               SCARD_DEBUG_ERR("path select failed, [%d]", ret);
+                       }
+               }
+               else
+               {
+                       SCARD_DEBUG_ERR("PKCS15 not found");
+               }
+
+               return result;
+       }
+
        PKCS15ODF *PKCS15::getODF()
        {
                if (odf == NULL)
        PKCS15ODF *PKCS15::getODF()
        {
                if (odf == NULL)
@@ -74,5 +121,4 @@ namespace smartcard_service_api
 
                return odf;
        }
 
                return odf;
        }
-
 } /* namespace smartcard_service_api */
 } /* namespace smartcard_service_api */
index c613775..7009957 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
index ce6646c..686cef6 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
 
 namespace smartcard_service_api
 {
 
 namespace smartcard_service_api
 {
-//     PKCS15ODF::PKCS15ODF():PKCS15Object()
-//     {
-//
-//     }
-
-       PKCS15ODF::PKCS15ODF(Channel *channel):PKCS15Object(channel), dodf(NULL)
+       PKCS15ODF::PKCS15ODF(Channel *channel)
+               : PKCS15Object(channel), dodf(NULL)
        {
                int ret = 0;
 
        {
                int ret = 0;
 
@@ -59,7 +54,8 @@ namespace smartcard_service_api
                }
        }
 
                }
        }
 
-       PKCS15ODF::PKCS15ODF(Channel *channel, ByteArray selectResponse):PKCS15Object(channel, selectResponse), dodf(NULL)
+       PKCS15ODF::PKCS15ODF(Channel *channel, ByteArray selectResponse)
+               : PKCS15Object(channel, selectResponse), dodf(NULL)
        {
                int ret = 0;
                ByteArray odfData;
        {
                int ret = 0;
                ByteArray odfData;
@@ -125,7 +121,8 @@ namespace smartcard_service_api
                                break;
 
                        default :
                                break;
 
                        default :
-                               SCARD_DEBUG("Unknown tlv : t [%X], l [%d], v %s", tlv.getTag(), tlv.getLength(), tlv.getValue().toString());
+                               SCARD_DEBUG("Unknown tlv : t [%X], l [%d], v %s",
+                                       tlv.getTag(), tlv.getLength(), tlv.getValue().toString());
                                break;
                        }
 
                                break;
                        }
 
index b4cd282..86a7923 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
index dbc65a3..debc182 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
index 33266d7..b3664bf 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
index 4508ba5..58bcef7 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
index c1f7f33..39817be 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
index bf625e8..1583a9b 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
 
 namespace smartcard_service_api
 {
 
 namespace smartcard_service_api
 {
-       ReaderHelper::ReaderHelper()
+       ReaderHelper::ReaderHelper() : seService(NULL), present(false)
        {
                memset(name, 0, sizeof(name));
        {
                memset(name, 0, sizeof(name));
-               seService = NULL;
-               present = false;
        }
 } /* namespace smartcard_service_api */
        }
 } /* namespace smartcard_service_api */
diff --git a/common/Record.cpp b/common/Record.cpp
deleted file mode 100644 (file)
index fcef62a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-/* standard library header */
-
-/* SLP library header */
-
-/* local header */
-#include "Record.h"
-
-namespace smartcard_service_api
-{
-       Record::Record()
-       {
-       }
-
-       Record::~Record()
-       {
-       }
-
-} /* namespace smartcard_service_api */
index 80bc53b..85ce608 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
index 06c3c01..f4daec8 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
index dec604e..fde6560 100644 (file)
@@ -1,39 +1,31 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 /* standard library header */
-#include <stdio.h>
 
 /* SLP library header */
 
 /* local header */
 
 /* SLP library header */
 
 /* local header */
-#include "Debug.h"
-#include "SessionHelper.h"
 #include "ReaderHelper.h"
 
 namespace smartcard_service_api
 {
 #include "ReaderHelper.h"
 
 namespace smartcard_service_api
 {
-       SessionHelper::SessionHelper(ReaderHelper *reader) : closed(true)
+       SessionHelper::SessionHelper(ReaderHelper *reader) :
+               closed(true)
        {
                this->reader = reader;
        }
        {
                this->reader = reader;
        }
-
-//     ByteArray SessionHelper::getATR()
-//     {
-//             return atr;
-//     }
 } /* namespace smartcard_service_api */
 } /* namespace smartcard_service_api */
index ee3f52e..c9fe8ae 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -26,6 +25,7 @@
 
 /* SLP library header */
 #include "package-manager.h"
 
 /* SLP library header */
 #include "package-manager.h"
+#include "pkgmgr-info.h"
 #include "aul.h"
 
 /* local header */
 #include "aul.h"
 
 /* local header */
@@ -83,13 +83,28 @@ namespace smartcard_service_api
                ByteArray result;
                int ret = 0;
                pkgmgr_certinfo_h handle = NULL;
                ByteArray result;
                int ret = 0;
                pkgmgr_certinfo_h handle = NULL;
+               pkgmgrinfo_appinfo_h handle_appinfo;
+               char *pkgid = NULL;
 
 
+               if(pkgmgrinfo_appinfo_get_appinfo(packageName, &handle_appinfo) != PMINFO_R_OK)
+               {
+                       SCARD_DEBUG_ERR("pkgmgrinfo_appinfo_get_appinfo fail");
+                       return result;
+               }
 
 
-               SCARD_DEBUG("package name : %s", packageName);
+               if(pkgmgrinfo_appinfo_get_pkgid(handle_appinfo, &pkgid) != PMINFO_R_OK)
+               {
+                       pkgmgrinfo_appinfo_destroy_appinfo(handle_appinfo);
+                       SCARD_DEBUG_ERR("pkgmgrinfo_appinfo_get_pkgid fail");
+                       return result;
+               }
+               pkgmgrinfo_appinfo_destroy_appinfo(handle_appinfo);
+
+               SCARD_DEBUG("package name : %s", pkgid);
 
                if ((ret = pkgmgr_pkginfo_create_certinfo(&handle)) == 0)
                {
 
                if ((ret = pkgmgr_pkginfo_create_certinfo(&handle)) == 0)
                {
-                       if ((ret = pkgmgr_pkginfo_load_certinfo(packageName, handle)) == 0)
+                       if ((ret = pkgmgr_pkginfo_load_certinfo(pkgid, handle)) == 0)
                        {
                                int type;
 
                        {
                                int type;
 
@@ -167,12 +182,27 @@ namespace smartcard_service_api
                bool result = false;
                int ret = 0;
                pkgmgr_certinfo_h handle = NULL;
                bool result = false;
                int ret = 0;
                pkgmgr_certinfo_h handle = NULL;
+               pkgmgrinfo_appinfo_h handle_appinfo;
+               char *pkgid = NULL;
 
 
-               SCARD_DEBUG("package name : %s", packageName);
+               if(pkgmgrinfo_appinfo_get_appinfo(packageName, &handle_appinfo) != PMINFO_R_OK)
+               {
+                       SCARD_DEBUG_ERR("pkgmgrinfo_appinfo_get_appinfo fail");
+                       return result;
+               }
+
+               if(pkgmgrinfo_appinfo_get_pkgid(handle_appinfo, &pkgid) != PMINFO_R_OK)
+               {
+                       pkgmgrinfo_appinfo_destroy_appinfo(handle_appinfo);
+                       SCARD_DEBUG_ERR("pkgmgrinfo_appinfo_get_pkgid fail");
+                       return result;
+               }
+
+               SCARD_DEBUG("package name : %s", pkgid);
 
                if ((ret = pkgmgr_pkginfo_create_certinfo(&handle)) == 0)
                {
 
                if ((ret = pkgmgr_pkginfo_create_certinfo(&handle)) == 0)
                {
-                       if ((ret = pkgmgr_pkginfo_load_certinfo(packageName, handle)) == 0)
+                       if ((ret = pkgmgr_pkginfo_load_certinfo(pkgid, handle)) == 0)
                        {
                                int type;
 
                        {
                                int type;
 
@@ -207,6 +237,8 @@ namespace smartcard_service_api
                                SCARD_DEBUG_ERR("pkgmgr_pkginfo_load_certinfo failed [%d]", ret);
                        }
 
                                SCARD_DEBUG_ERR("pkgmgr_pkginfo_load_certinfo failed [%d]", ret);
                        }
 
+                       pkgmgrinfo_appinfo_destroy_appinfo(handle_appinfo);
+
                        pkgmgr_pkginfo_destroy_certinfo(handle);
                }
                else
                        pkgmgr_pkginfo_destroy_certinfo(handle);
                }
                else
index 2110e30..638e6c7 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
index 6781467..03ff05c 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
index 2a8adb7..b577996 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -81,6 +80,7 @@ namespace smartcard_service_api
        bool TLVHelper::_decodeTLV()
        {
                int result;
        bool TLVHelper::_decodeTLV()
        {
                int result;
+               int temp = 0;
 
                currentT = 0;
                currentL = 0;
 
                currentT = 0;
                currentL = 0;
@@ -90,26 +90,31 @@ namespace smartcard_service_api
                        return false;
 
                /* T */
                        return false;
 
                /* T */
-               if ((result = decodeTag(tlvBuffer.getBuffer(offset))) < 0)
+               if ((result = decodeTag(tlvBuffer.getBuffer(offset + temp))) < 0)
                        return false;
 
                        return false;
 
-               offset += result;
+               temp += result;
 
                /* L */
 
                /* L */
-               if ((result = decodeLength(tlvBuffer.getBuffer(offset))) < 0)
+               if ((result = decodeLength(tlvBuffer.getBuffer(offset + temp))) < 0)
                        return false;
 
                        return false;
 
-               offset += result;
+               temp += result;
 
                if (currentL > 0)
                {
 
                if (currentL > 0)
                {
+                       if (currentL > (tlvBuffer.getLength() - (offset + temp)))
+                               return false;
+
                        /* V */
                        /* V */
-                       if ((result = decodeValue(tlvBuffer.getBuffer(offset))) < 0)
+                       if ((result = decodeValue(tlvBuffer.getBuffer(offset + temp))) < 0)
                                return false;
 
                                return false;
 
-                       offset += result;
+                       temp += result;
                }
 
                }
 
+               offset += temp;
+
                return true;
        }
 
                return true;
        }
 
index 61cdd56..0f24ac8 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef APDUHELPER_H_
 #define APDUHELPER_H_
 
 #ifndef APDUHELPER_H_
 #define APDUHELPER_H_
@@ -36,7 +35,29 @@ namespace smartcard_service_api
                ByteArray dataField;
 
                static int parseStatusWord(unsigned char *sw);
                ByteArray dataField;
 
                static int parseStatusWord(unsigned char *sw);
+
        public:
        public:
+               static const int SUCCESS = 0;
+
+               static const int ERROR_UNKNOWN = -1;
+
+               static const int ERROR_NO_INFORMATION = -(0x6900);
+               static const int ERROR_COMMAND_INCOMPATIBLE = -(0x6981);
+               static const int ERROR_SECURITY_NOT_SATISFIED = -(0x6982);
+               static const int ERROR_AUTH_PIN_BLOCKED = -(0x6983);
+               static const int ERROR_REF_DATA_INVALID = -(0x6984);
+               static const int ERROR_CONDITION_NOT_SATIFIED = -(0x6985);
+               static const int ERROR_COMMAND_NOT_ALLOW = -(0x6986);
+
+               static const int ERROR_INCORRECT_PARAMETER = -(0x6a80);
+               static const int ERROR_FUNCTION_NOT_SUPPORT = -(0x6a81);
+               static const int ERROR_FILE_NOT_FOUND = -(0x6a82);
+               static const int ERROR_RECORD_NOT_FOUND = -(0x6a83);
+               static const int ERROR_NOT_ENOUGH_MEMORY = -(0x6a84);
+               static const int ERROR_INCORRECT_P1_P2 = -(0x6a86);
+               static const int ERROR_LC_INCONSISTENT = -(0x6a87);
+               static const int ERROR_REF_DATA_NOT_FOUND = -(0x6a88);
+
                ResponseHelper();
                ResponseHelper(const ByteArray &response);
                ~ResponseHelper();
                ResponseHelper();
                ResponseHelper(const ByteArray &response);
                ~ResponseHelper();
@@ -118,10 +139,13 @@ namespace smartcard_service_api
                static const unsigned char CLA_CHANNEL_STANDARD = (unsigned char)0x00;
                static const unsigned char CLA_CHANNEL_EXTENDED = (unsigned char)0x01;
 
                static const unsigned char CLA_CHANNEL_STANDARD = (unsigned char)0x00;
                static const unsigned char CLA_CHANNEL_EXTENDED = (unsigned char)0x01;
 
+               static const unsigned int LE_MAX = -1;
+
                APDUCommand();
                ~APDUCommand();
 
                APDUCommand();
                ~APDUCommand();
 
-               bool setCommand(unsigned char cla, unsigned char ins, unsigned char p1, unsigned char p2, ByteArray commandData, unsigned int maxResponseSize);
+               bool setCommand(unsigned char cla, unsigned char ins, unsigned char p1,
+                       unsigned char p2, ByteArray commandData, unsigned int maxResponseSize);
                bool setCommand(const ByteArray &command);
 
                bool setChannel(int type, int channelNum);
                bool setCommand(const ByteArray &command);
 
                bool setChannel(int type, int channelNum);
@@ -142,7 +166,7 @@ namespace smartcard_service_api
                ByteArray getCommandData();
 
                void setMaxResponseSize(unsigned int maxResponseSize);
                ByteArray getCommandData();
 
                void setMaxResponseSize(unsigned int maxResponseSize);
-               unsigned int setMaxResponseSize();
+               unsigned int getMaxResponseSize();
 
                bool getBuffer(ByteArray &array);
        };
 
                bool getBuffer(ByteArray &array);
        };
index 56dcea3..20ca90a 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef ACCESSCONDITION_H_
 #define ACCESSCONDITION_H_
 
 #ifndef ACCESSCONDITION_H_
 #define ACCESSCONDITION_H_
index 892d890..1bbbb76 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef ACCESSCONTROLLIST_H_
 #define ACCESSCONTROLLIST_H_
 
 #ifndef ACCESSCONTROLLIST_H_
 #define ACCESSCONTROLLIST_H_
index e7a9534..cc08c5b 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef BYTEARRAY_H_
 #define BYTEARRAY_H_
 
 #ifndef BYTEARRAY_H_
 #define BYTEARRAY_H_
index 5813165..a6a5dc9 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef CHANNEL_H_
 #define CHANNEL_H_
 
 #ifndef CHANNEL_H_
 #define CHANNEL_H_
 /* local header */
 #include "Synchronous.h"
 #include "ByteArray.h"
 /* local header */
 #include "Synchronous.h"
 #include "ByteArray.h"
+#include "Exception.h"
 
 namespace smartcard_service_api
 {
        class SessionHelper;    /* explicit declaration */
 
 
 namespace smartcard_service_api
 {
        class SessionHelper;    /* explicit declaration */
 
-       typedef void (*transmitCallback)(unsigned char *buffer, unsigned int length, int error, void *userParam);
+       typedef void (*transmitCallback)(unsigned char *buffer, unsigned int length,
+               int error, void *userParam);
        typedef void (*closeCallback)(int error, void *userParam);
 
        class Channel : public Synchronous
        typedef void (*closeCallback)(int error, void *userParam);
 
        class Channel : public Synchronous
@@ -40,29 +41,28 @@ namespace smartcard_service_api
                SessionHelper *session;
                int channelNum;
 
                SessionHelper *session;
                int channelNum;
 
-               Channel() : Synchronous()
-               {
-                       channelNum = -1;
-               }
-               Channel(SessionHelper *session) : Synchronous()
-               {
-                       this->session = session;
-               }
+               Channel() : Synchronous() { channelNum = -1; }
+               Channel(SessionHelper *session) : Synchronous() { this->session = session; }
+
+               inline void setSelectResponse(ByteArray &response) { selectResponse = response; }
 
        public :
                virtual ~Channel() {};
 
 
        public :
                virtual ~Channel() {};
 
-               inline bool isBasicChannel() const { return (channelNum == 0); }
-               inline bool isClosed() const { return (channelNum < 0); }
+               inline bool isBasicChannel() const throw() { return (channelNum == 0); }
+               inline bool isClosed() const throw() { return (channelNum < 0); }
 
 
-               inline ByteArray getSelectResponse() const { return selectResponse; }
-               inline SessionHelper *getSession() const { return session; }
+               inline ByteArray getSelectResponse() const throw() { return selectResponse; }
+               inline SessionHelper *getSession() const throw() { return session; }
 
                virtual int close(closeCallback callback, void *userParam) = 0;
                virtual int transmit(ByteArray command, transmitCallback callback, void *userData) = 0;
 
 
                virtual int close(closeCallback callback, void *userParam) = 0;
                virtual int transmit(ByteArray command, transmitCallback callback, void *userData) = 0;
 
-               virtual void closeSync() = 0;
-               virtual int transmitSync(ByteArray command, ByteArray &result) = 0;
+               virtual void closeSync()
+                       throw(ErrorIO &, ErrorIllegalState &) = 0;
+
+               virtual int transmitSync(ByteArray command, ByteArray &result)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) = 0;
        };
 
 } /* namespace smartcard_service_api */
        };
 
 } /* namespace smartcard_service_api */
index a7dc03f..7cba0dc 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef DEBUG_H_
 #define DEBUG_H_
 
 #ifndef DEBUG_H_
 #define DEBUG_H_
index 647e3c5..2703f43 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef DISPATCHERHELPER_H_
 #define DISPATCHERHELPER_H_
 
 #ifndef DISPATCHERHELPER_H_
 #define DISPATCHERHELPER_H_
index 534d549..69138ba 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef DISPATCHERMSG_H_
 #define DISPATCHERMSG_H_
 
 #ifndef DISPATCHERMSG_H_
 #define DISPATCHERMSG_H_
diff --git a/common/include/EFDIR.h b/common/include/EFDIR.h
new file mode 100644 (file)
index 0000000..c2fd9f1
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef EFDIR_H_
+#define EFDIR_H_
+
+/* standard library header */
+#include <vector>
+
+/* SLP library header */
+
+/* local header */
+#include "FileObject.h"
+
+using namespace std;
+
+namespace smartcard_service_api
+{
+       class EFDIR : public FileObject
+       {
+       private:
+               ByteArray parseRecord(Record &record, ByteArray &aid);
+
+       public:
+               static const unsigned int EFDIR_FID = 0x002f;
+
+               EFDIR(Channel *channel);
+               EFDIR(Channel *channel, ByteArray selectResponse);
+               ~EFDIR();
+
+               ByteArray getPathByAID(ByteArray &aid);
+       };
+} /* namespace smartcard_service_api */
+#endif /* EFDIR_H_ */
diff --git a/common/include/Exception.h b/common/include/Exception.h
new file mode 100644 (file)
index 0000000..2ff91d8
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef EXCEPTION_H_
+#define EXCEPTION_H_
+
+#include <exception>
+#include <stddef.h>
+
+#include "smartcard-types.h"
+
+namespace smartcard_service_api
+{
+       class ExceptionBase : public std::exception
+       {
+       protected :
+               int errorCode;
+
+       public :
+               ExceptionBase(int errorCode) throw()
+                       : errorCode(errorCode) {}
+               virtual ~ExceptionBase() throw() {}
+
+               int getErrorCode() throw() { return errorCode; }
+               virtual const char *what() const throw()
+               {
+                       return "Unknown exception";
+               }
+       };
+
+       class ErrorIO : public ExceptionBase
+       {
+       private :
+               unsigned char sw[2];
+
+       public :
+               ErrorIO(int errorCode) throw()
+                       : ExceptionBase(errorCode) {}
+               ErrorIO(int errorCode, unsigned char *sw) throw()
+                       : ExceptionBase(errorCode)
+               {
+                       if (sw != NULL)
+                       {
+                               this->sw[0] = sw[0];
+                               this->sw[1] = sw[1];
+                       }
+               }
+               virtual ~ErrorIO() throw() {}
+
+               unsigned short getSW() throw()
+                       { return (unsigned short)(sw[0] << 8 | sw[1]); }
+               unsigned char getSW1() throw() { return sw[0]; }
+               unsigned char getSW2() throw() { return sw[1]; }
+
+               virtual const char *what() const throw()
+               {
+                       const char *result = NULL;
+
+                       switch (errorCode)
+                       {
+                       case SCARD_ERROR_IPC_FAILED :
+                               result = "Failed to communicate with server";
+                               break;
+
+                       case SCARD_ERROR_IO_FAILED :
+                               result = "IO Operation failed";
+                               break;
+
+                       default :
+                               result = ExceptionBase::what();
+                               break;
+                       }
+
+                       return result;
+               }
+       };
+
+       class ErrorSecurity : public ExceptionBase
+       {
+       public :
+               ErrorSecurity(int errorCode) throw()
+                       : ExceptionBase(errorCode) {}
+               virtual ~ErrorSecurity() throw() {}
+
+               virtual const char *what() const throw()
+               {
+                       const char *result = NULL;
+
+                       switch (errorCode)
+                       {
+                       case SCARD_ERROR_SECURITY_NOT_ALLOWED :
+                               result = "Access denied";
+                               break;
+
+                       default :
+                               result = ExceptionBase::what();
+                               break;
+                       }
+
+                       return result;
+               }
+       };
+
+       class ErrorIllegalState : public ExceptionBase
+       {
+       public :
+               ErrorIllegalState(int errorCode) throw()
+                       : ExceptionBase(errorCode) {}
+               virtual ~ErrorIllegalState() throw() {}
+
+               virtual const char *what() const throw()
+               {
+                       const char *result = NULL;
+
+                       switch (errorCode)
+                       {
+                       case SCARD_ERROR_UNAVAILABLE :
+                               result = "Closed instance";
+                               break;
+
+                       case SCARD_ERROR_NOT_INITIALIZED :
+                               result = "Need to initialize IPC";
+                               break;
+
+                       case SCARD_ERROR_SE_NOT_INITIALIZED :
+                               result = "Need to initialize SE";
+                               break;
+
+                       default :
+                               result = ExceptionBase::what();
+                               break;
+                       }
+
+                       return result;
+               }
+       };
+
+       class ErrorIllegalParameter : public ExceptionBase
+       {
+       public :
+               ErrorIllegalParameter(int errorCode) throw()
+                       : ExceptionBase(errorCode) {}
+               virtual ~ErrorIllegalParameter() throw() {}
+
+               virtual const char *what() const throw()
+               {
+                       const char *result = NULL;
+
+                       switch (errorCode)
+                       {
+                       case SCARD_ERROR_ILLEGAL_PARAM :
+                               result = "Incorrect format of parameter";
+                               break;
+
+                       default :
+                               result = ExceptionBase::what();
+                               break;
+                       }
+
+                       return result;
+               }
+       };
+} /* namespace smartcard_service_api */
+
+#endif /* EXCEPTIONBASE_H_ */
index 6f993a3..78917d0 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef FCI_H_
 #define FCI_H_
 
 #ifndef FCI_H_
 #define FCI_H_
index 628eed0..ec9e90b 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef FILEOBJECT_H_
 #define FILEOBJECT_H_
 
 #ifndef FILEOBJECT_H_
 #define FILEOBJECT_H_
@@ -56,10 +55,13 @@ namespace smartcard_service_api
                static const int ERROR_IO = -6;
                static const int ERROR_UNKNOWN = -99;
 
                static const int ERROR_IO = -6;
                static const int ERROR_UNKNOWN = -99;
 
+               static const unsigned int MF_FID = 0x003F;
+
                FileObject(Channel *channel);
                FileObject(Channel *channel, ByteArray selectResponse);
                ~FileObject();
 
                FileObject(Channel *channel);
                FileObject(Channel *channel, ByteArray selectResponse);
                ~FileObject();
 
+               void close();
                inline bool isClosed() { return (opened == false); }
                int select(ByteArray aid);
                int select(ByteArray path, bool fromCurrentDF);
                inline bool isClosed() { return (opened == false); }
                int select(ByteArray aid);
                int select(ByteArray path, bool fromCurrentDF);
index c5ecd03..4e1bb8e 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef GPSEACL_H_
 #define GPSEACL_H_
 
 #ifndef GPSEACL_H_
 #define GPSEACL_H_
index 1168058..de6e931 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef IPCHELPER_H_
 #define IPCHELPER_H_
 
 #ifndef IPCHELPER_H_
 #define IPCHELPER_H_
index 75fc526..45340ec 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef ISO7816BERTLV_H_
 #define ISO7816BERTLV_H_
 
 #ifndef ISO7816BERTLV_H_
 #define ISO7816BERTLV_H_
index f67a3df..4d9e0e4 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef LOCK_H_
 #define LOCK_H_
 
 #ifndef LOCK_H_
 #define LOCK_H_
index 22bd531..a911800 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef MESSAGE_H_
 #define MESSAGE_H_
 
 #ifndef MESSAGE_H_
 #define MESSAGE_H_
index eef1587..2df1185 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef NUMBERSTREAM_H_
 #define NUMBERSTREAM_H_
 
 #ifndef NUMBERSTREAM_H_
 #define NUMBERSTREAM_H_
index 4f18a29..b914701 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdint.h>
 
 /* standard library header */
 #include <stdint.h>
index 0c07780..b761eba 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef PKCS15_H_
 #define PKCS15_H_
 
 #ifndef PKCS15_H_
 #define PKCS15_H_
@@ -37,6 +36,8 @@ namespace smartcard_service_api
                map<unsigned int, ByteArray> recordElement;
                PKCS15ODF *odf;
 
                map<unsigned int, ByteArray> recordElement;
                PKCS15ODF *odf;
 
+               bool selectFromEFDIR();
+
        public:
                static ByteArray PKCS15_AID;
 
        public:
                static ByteArray PKCS15_AID;
 
index aa53551..3860b54 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef PKCS15DODF_H_
 #define PKCS15DODF_H_
 
 #ifndef PKCS15DODF_H_
 #define PKCS15DODF_H_
index e1a17c9..3139959 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef PKCS15ODF_H_
 #define PKCS15ODF_H_
 
 #ifndef PKCS15ODF_H_
 #define PKCS15ODF_H_
index a218ad4..86b1312 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef PKCS15OID_H_
 #define PKCS15OID_H_
 
 #ifndef PKCS15OID_H_
 #define PKCS15OID_H_
index 2f8f9a1..8a0653e 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef PKCS15OBJECT_H_
 #define PKCS15OBJECT_H_
 
 #ifndef PKCS15OBJECT_H_
 #define PKCS15OBJECT_H_
index 71dda37..c57dfe9 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef PKCS15Path_H_
 #define PKCS15Path_H_
 
 #ifndef PKCS15Path_H_
 #define PKCS15Path_H_
index 62e748b..44a86f3 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef PKCS15TOKENINFO_H_
 #define PKCS15TOKENINFO_H_
 
 #ifndef PKCS15TOKENINFO_H_
 #define PKCS15TOKENINFO_H_
index 1321ed2..ef6dab4 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef PROVIDERHELPER_H_
 #define PROVIDERHELPER_H_
 
 #ifndef PROVIDERHELPER_H_
 #define PROVIDERHELPER_H_
index 84e5e7a..9a42d2b 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef READERHELPER_H_
 #define READERHELPER_H_
 
 #ifndef READERHELPER_H_
 #define READERHELPER_H_
@@ -44,18 +43,19 @@ namespace smartcard_service_api
                bool present;
 
                ReaderHelper();
                bool present;
 
                ReaderHelper();
-
-       public:
                virtual ~ReaderHelper() {}
 
                virtual ~ReaderHelper() {}
 
+       public:
                inline const char *getName() { return name; }
                inline SEServiceHelper *getSEService() { return seService; }
                inline bool isSecureElementPresent() { return present; }
 
                inline const char *getName() { return name; }
                inline SEServiceHelper *getSEService() { return seService; }
                inline bool isSecureElementPresent() { return present; }
 
-               virtual void closeSessions() = 0;
+               virtual void closeSessions()
+                       throw(ErrorIO &, ErrorIllegalState &) = 0;
 
                virtual int openSession(openSessionCallback callback, void *userData) = 0;
 
                virtual int openSession(openSessionCallback callback, void *userData) = 0;
-               virtual SessionHelper *openSessionSync() = 0;
+               virtual SessionHelper *openSessionSync()
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)= 0;
        };
 
 } /* namespace smartcard_service_api */
        };
 
 } /* namespace smartcard_service_api */
index dcf79cb..0044d4d 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef RECORD_H_
 #define RECORD_H_
 
 #ifndef RECORD_H_
 #define RECORD_H_
@@ -25,16 +24,17 @@ namespace smartcard_service_api
        class Record
        {
        private:
        class Record
        {
        private:
-               ByteArray data;
                unsigned int id;
                unsigned int id;
+               ByteArray data;
 
        public:
 
        public:
-               Record();
-               Record(unsigned int id, ByteArray buffer);
-               ~Record();
+               Record() : id(0) {}
+               Record(unsigned int id, ByteArray buffer)
+                       : id(id), data(buffer) {};
+               ~Record() {}
 
 
-               unsigned int getID();
-               int getData(ByteArray &buffer);
+               inline unsigned int getID() { return id; }
+               inline ByteArray getData() { return data; }
        };
 
 } /* namespace smartcard_service_api */
        };
 
 } /* namespace smartcard_service_api */
index b39c2cb..f95270b 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SESERVICEHELPER_H_
 #define SESERVICEHELPER_H_
 
 #ifndef SESERVICEHELPER_H_
 #define SESERVICEHELPER_H_
index 8db4f4d..564f80d 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SERIALIZABLE_H_
 #define SERIALIZABLE_H_
 
 #ifndef SERIALIZABLE_H_
 #define SERIALIZABLE_H_
index 8a9e0f1..8599612 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SESSIONHELPER_H_
 #define SESSIONHELPER_H_
 
 #ifndef SESSIONHELPER_H_
 #define SESSIONHELPER_H_
@@ -51,10 +50,11 @@ namespace smartcard_service_api
                SessionHelper(ReaderHelper *reader);
                virtual ~SessionHelper() {}
 
                SessionHelper(ReaderHelper *reader);
                virtual ~SessionHelper() {}
 
-               ReaderHelper *getReader() { return reader; }
-               bool isClosed() { return closed; }
+               ReaderHelper *getReader() const throw() { return reader; }
+               bool isClosed() const throw() { return closed; }
 
 
-               virtual void closeChannels() = 0;
+               virtual void closeChannels()
+                       throw(ErrorIO &, ErrorIllegalState &) = 0;
 
                virtual int getATR(getATRCallback callback, void *userData) = 0;
                virtual int close(closeSessionCallback callback, void *userData) = 0;
 
                virtual int getATR(getATRCallback callback, void *userData) = 0;
                virtual int close(closeSessionCallback callback, void *userData) = 0;
@@ -64,13 +64,23 @@ namespace smartcard_service_api
                virtual int openLogicalChannel(ByteArray aid, openChannelCallback callback, void *userData) = 0;
                virtual int openLogicalChannel(unsigned char *aid, unsigned int length, openChannelCallback callback, void *userData) = 0;
 
                virtual int openLogicalChannel(ByteArray aid, openChannelCallback callback, void *userData) = 0;
                virtual int openLogicalChannel(unsigned char *aid, unsigned int length, openChannelCallback callback, void *userData) = 0;
 
-               virtual ByteArray getATRSync() = 0;
-               virtual void closeSync() = 0;
+               virtual ByteArray getATRSync()
+                       throw(ErrorIO &, ErrorIllegalState &) = 0;
+
+               virtual void closeSync()
+                       throw(ErrorIO &, ErrorIllegalState &) = 0;
+
+               virtual Channel *openBasicChannelSync(ByteArray aid)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) = 0;
+
+               virtual Channel *openBasicChannelSync(unsigned char *aid, unsigned int length)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) = 0;
+
+               virtual Channel *openLogicalChannelSync(ByteArray aid)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) = 0;
 
 
-               virtual Channel *openBasicChannelSync(ByteArray aid) = 0;
-               virtual Channel *openBasicChannelSync(unsigned char *aid, unsigned int length) = 0;
-               virtual Channel *openLogicalChannelSync(ByteArray aid) = 0;
-               virtual Channel *openLogicalChannelSync(unsigned char *aid, unsigned int length) = 0;
+               virtual Channel *openLogicalChannelSync(unsigned char *aid, unsigned int length)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) = 0;
        };
 
 } /* namespace smartcard_service_api */
        };
 
 } /* namespace smartcard_service_api */
index 45fbaf9..d5abc22 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SIGNATUREHELPER_H_
 #define SIGNATUREHELPER_H_
 
 #ifndef SIGNATUREHELPER_H_
 #define SIGNATUREHELPER_H_
index bcaa743..a31d182 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SIMPLETLV_H_
 #define SIMPLETLV_H_
 
 #ifndef SIMPLETLV_H_
 #define SIMPLETLV_H_
index 4fa7ef8..479b902 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SYNCHRONOUS_H_
 #define SYNCHRONOUS_H_
 
 #ifndef SYNCHRONOUS_H_
 #define SYNCHRONOUS_H_
index 63f0a94..55e64ca 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef TLVHELPER_H_
 #define TLVHELPER_H_
 
 #ifndef TLVHELPER_H_
 #define TLVHELPER_H_
index ad0ddff..dccc9bf 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef TERMINAL_H_
 #define TERMINAL_H_
 
 #ifndef TERMINAL_H_
 #define TERMINAL_H_
index 15c6831..311b43a 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef TERMINALINTERFACE_H_
 #define TERMINALINTERFACE_H_
 
 #ifndef TERMINALINTERFACE_H_
 #define TERMINALINTERFACE_H_
index 055756d..6b03bd0 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SMARTCARD_TYPES_H_
 #define SMARTCARD_TYPES_H_
 
 #ifndef SMARTCARD_TYPES_H_
 #define SMARTCARD_TYPES_H_
 #include <stdint.h>
 #include <stdbool.h>
 
 #include <stdint.h>
 #include <stdbool.h>
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
 enum
 {
 enum
 {
-       SCARD_ERROR_OK                                          = 0,
+       SCARD_ERROR_OK                          = 0,
 
 
-       SCARD_ERROR_NOT_INITIALIZED                     = -(0x10),
+       SCARD_ERROR_NOT_INITIALIZED             = -(0x10),
        SCARD_ERROR_SE_NOT_INITIALIZED          = -(0x11),
        SCARD_ERROR_OPERATION_NOT_SUPPORTED     = -(0x12),
        SCARD_ERROR_SE_NOT_INITIALIZED          = -(0x11),
        SCARD_ERROR_OPERATION_NOT_SUPPORTED     = -(0x12),
-       SCARD_ERROR_IPC_FAILED                          = -(0x13),
-       SCARD_ERROR_OUT_OF_MEMORY                       = -(0x14),
+       SCARD_ERROR_IPC_FAILED                  = -(0x13),
+       SCARD_ERROR_OUT_OF_MEMORY               = -(0x14),
        SCARD_ERROR_NOT_ENOUGH_RESOURCE         = -(0x15),
        SCARD_ERROR_OPERATION_TIMEOUT           = -(0x16),
        SCARD_ERROR_NEED_MORE_BUFFER            = -(0x17),
        SCARD_ERROR_NOT_ENOUGH_RESOURCE         = -(0x15),
        SCARD_ERROR_OPERATION_TIMEOUT           = -(0x16),
        SCARD_ERROR_NEED_MORE_BUFFER            = -(0x17),
-       SCARD_ERROR_NOT_SUPPORTED                       = -(0x18),
-       SCARD_ERROR_UNAVAILABLE                         = -(0x19),
+       SCARD_ERROR_NOT_SUPPORTED               = -(0x18),
+       SCARD_ERROR_UNAVAILABLE                 = -(0x19),
 
 
-       SCARD_ERROR_IO_FAILED                           = -(0x50),
+       SCARD_ERROR_IO_FAILED                   = -(0x50),
        SCARD_ERROR_SECURITY_NOT_ALLOWED        = -(0x51),
        SCARD_ERROR_SECURITY_NOT_ALLOWED        = -(0x51),
-       SCARD_ERROR_ILLEGAL_STATE                       = -(0x52),
-       SCARD_ERROR_ILLEGAL_PARAM                       = -(0x53),
+       SCARD_ERROR_ILLEGAL_STATE               = -(0x52),
+       SCARD_ERROR_ILLEGAL_PARAM               = -(0x53),
        SCARD_ERROR_ILLEGAL_REFERENCE           = -(0x54),
 
        SCARD_ERROR_ILLEGAL_REFERENCE           = -(0x54),
 
-       SCARD_ERROR_UNKNOWN                                     = -(0x99),
+       SCARD_ERROR_UNKNOWN                     = -(0x99),
 };
 
 typedef void *se_service_h;
 };
 
 typedef void *se_service_h;
@@ -64,4 +68,8 @@ typedef void (*session_get_channel_count_cb)(unsigned count, int error, void *us
 typedef void (*channel_transmit_cb)(unsigned char *buffer, unsigned int length, int error, void *user_data);
 typedef void (*channel_close_cb)(int error, void *user_data);
 
 typedef void (*channel_transmit_cb)(unsigned char *buffer, unsigned int length, int error, void *user_data);
 typedef void (*channel_close_cb)(int error, void *user_data);
 
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
 #endif /* SMARTCARD_TYPES_H_ */
 #endif /* SMARTCARD_TYPES_H_ */
index 66032cf..2a49cde 100644 (file)
@@ -1,6 +1,6 @@
 Name:       smartcard-service
 Summary:    Smartcard Service FW
 Name:       smartcard-service
 Summary:    Smartcard Service FW
-Version:    0.1.11
+Version:    0.1.15
 Release:    0
 Group:      libs
 License:    Apache License, Version 2.0
 Release:    0
 Group:      libs
 License:    Apache License, Version 2.0
@@ -11,11 +11,12 @@ Source0:    %{name}-%{version}.tar.gz
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(security-server)
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(security-server)
 BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(aul)
 BuildRequires: pkgconfig(libssl)
 BuildRequires: pkgconfig(dbus-glib-1)
 BuildRequires: pkgconfig(pkgmgr)
 BuildRequires: pkgconfig(libssl)
 BuildRequires: pkgconfig(dbus-glib-1)
 BuildRequires: pkgconfig(pkgmgr)
-BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(pkgmgr-info)
 BuildRequires: cmake
 BuildRequires: gettext-tools
 
 BuildRequires: cmake
 BuildRequires: gettext-tools
 
index 901d085..0814195 100644 (file)
@@ -27,12 +27,12 @@ IF("${USE_AUTOSTART}" STREQUAL "1")
 ENDIF()
 
 SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs  -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden")
 ENDIF()
 
 SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs  -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden")
-SET(ARM_CXXFLAGS "${ARM_CXXLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fPIC")
+SET(ARM_CXXFLAGS "${ARM_CXXLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fpic")
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
 
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs  -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden")
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
 
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs  -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden")
-SET(ARM_CFLAGS "${ARM_CLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fPIC")
+SET(ARM_CFLAGS "${ARM_CLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fpic")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
index 0dc84c4..6c141b9 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <pthread.h>
 
 /* standard library header */
 #include <pthread.h>
index 2bac293..d0f880a 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
@@ -25,7 +25,9 @@
 
 namespace smartcard_service_api
 {
 
 namespace smartcard_service_api
 {
-       ServerChannel::ServerChannel(ServerSession *session, void *caller, int channelNum, Terminal *terminal):Channel(session)
+       ServerChannel::ServerChannel(ServerSession *session, void *caller,
+               int channelNum, Terminal *terminal)
+               : Channel(session)
        {
                this->terminal = terminal;
                this->caller = caller;
        {
                this->terminal = terminal;
                this->caller = caller;
@@ -42,6 +44,7 @@ namespace smartcard_service_api
        }
 
        void ServerChannel::closeSync()
        }
 
        void ServerChannel::closeSync()
+               throw(ErrorIO &, ErrorIllegalState &)
        {
                ByteArray command, result;
                APDUHelper apdu;
        {
                ByteArray command, result;
                APDUHelper apdu;
@@ -76,12 +79,14 @@ namespace smartcard_service_api
        }
 
        int ServerChannel::transmitSync(ByteArray command, ByteArray &result)
        }
 
        int ServerChannel::transmitSync(ByteArray command, ByteArray &result)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
        {
+               int ret = -1;
                APDUCommand helper;
 
                if (isClosed() == true)
                {
                APDUCommand helper;
 
                if (isClosed() == true)
                {
-                       return -1;
+                       return ret;
                }
 
                helper.setCommand(command);
                }
 
                helper.setCommand(command);
@@ -89,7 +94,8 @@ namespace smartcard_service_api
                /* filter command */
                if (privilege == false)
                {
                /* filter command */
                if (privilege == false)
                {
-                       if ((helper.getINS() == APDUCommand::INS_SELECT_FILE && helper.getP1() == APDUCommand::P1_SELECT_BY_DF_NAME) ||
+                       if ((helper.getINS() == APDUCommand::INS_SELECT_FILE &&
+                               helper.getP1() == APDUCommand::P1_SELECT_BY_DF_NAME) ||
                                (helper.getINS() == APDUCommand::INS_MANAGE_CHANNEL))
                        {
                                return -4; /* security reason */
                                (helper.getINS() == APDUCommand::INS_MANAGE_CHANNEL))
                        {
                                return -4; /* security reason */
@@ -103,7 +109,15 @@ namespace smartcard_service_api
 
                SCARD_DEBUG("command [%d] : %s", command.getLength(), command.toString());
 
 
                SCARD_DEBUG("command [%d] : %s", command.getLength(), command.toString());
 
-               return terminal->transmitSync(command, result);
+               ret = terminal->transmitSync(command, result);
+               if (ret == 0 && ResponseHelper::getStatus(result) == 0)
+               {
+                       /* store select response */
+                       if (helper.getINS() == APDUCommand::INS_SELECT_FILE)
+                               setSelectResponse(result);
+               }
+
+               return ret;
        }
 
 } /* namespace smartcard_service_api */
        }
 
 } /* namespace smartcard_service_api */
index 0069c58..c502f8a 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -87,6 +86,8 @@ namespace smartcard_service_api
                                ByteArray info;
                                ClientInstance *instance = NULL;
 
                                ByteArray info;
                                ClientInstance *instance = NULL;
 
+                               resource->loadSecureElements();
+
                                if ((instance = resource->getClient(socket)) != NULL)
                                {
                                        /* update client PID */
                                if ((instance = resource->getClient(socket)) != NULL)
                                {
                                        /* update client PID */
index fae1809..eb25f24 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <string.h>
 
 /* standard library header */
 #include <string.h>
@@ -245,7 +245,7 @@ ERROR :
 
                        if (peerSocket >= 0)
                        {
 
                        if (peerSocket >= 0)
                        {
-                               Message *msg = NULL;
+                               Message *msg;
 
                                /* read message */
                                if ((msg = retrieveMessage(peerSocket)) != NULL)
 
                                /* read message */
                                if ((msg = retrieveMessage(peerSocket)) != NULL)
index 2aace13..fa51f1a 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -30,7 +30,8 @@
 
 namespace smartcard_service_api
 {
 
 namespace smartcard_service_api
 {
-       ServerReader::ServerReader(ServerSEService *seService, char *name, Terminal *terminal):ReaderHelper()
+       ServerReader::ServerReader(ServerSEService *seService, char *name, Terminal *terminal) :
+               ReaderHelper()
        {
                unsigned int length = 0;
 
        {
                unsigned int length = 0;
 
@@ -76,6 +77,7 @@ namespace smartcard_service_api
        }
 
        void ServerReader::closeSessions()
        }
 
        void ServerReader::closeSessions()
+               throw(ErrorIO &, ErrorIllegalState &)
        {
                size_t i;
 
        {
                size_t i;
 
@@ -108,14 +110,15 @@ namespace smartcard_service_api
        }
 
        ServerSession *ServerReader::openSessionSync()
        }
 
        ServerSession *ServerReader::openSessionSync()
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                vector<ByteArray> temp;
 
                return openSessionSync(temp, NULL);
        }
 
        {
                vector<ByteArray> temp;
 
                return openSessionSync(temp, NULL);
        }
 
-
        ServerSession *ServerReader::openSessionSync(vector<ByteArray> &certHashes, void *caller)
        ServerSession *ServerReader::openSessionSync(vector<ByteArray> &certHashes, void *caller)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                ServerSession *session = NULL;
 
        {
                ServerSession *session = NULL;
 
index ab43d2b..064f765 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -79,16 +78,14 @@ namespace smartcard_service_api
 
 #define OMAPI_SE_PATH "/usr/lib/se"
 
 
 #define OMAPI_SE_PATH "/usr/lib/se"
 
-       ServerResource::ServerResource() : mainLoop(NULL)
+       ServerResource::ServerResource()
+               : mainLoop(NULL), seLoaded(false)
        {
                SCARD_BEGIN();
 
                serverIPC = ServerIPC::getInstance();
                serverDispatcher = ServerDispatcher::getInstance();
 
        {
                SCARD_BEGIN();
 
                serverIPC = ServerIPC::getInstance();
                serverDispatcher = ServerDispatcher::getInstance();
 
-#if 1
-               loadSecureElements();
-#endif
                SCARD_END();
        }
 
                SCARD_END();
        }
 
@@ -578,7 +575,7 @@ namespace smartcard_service_api
                        channelNum = _openLogicalChannel(terminal);
                        if (channelNum > 0)
                        {
                        channelNum = _openLogicalChannel(terminal);
                        if (channelNum > 0)
                        {
-                               SCARD_DEBUG("channelNum [%d]", result);
+                               SCARD_DEBUG("channelNum [%d]", channelNum);
                        }
                        else
                        {
                        }
                        else
                        {
@@ -608,30 +605,42 @@ namespace smartcard_service_api
                                aid, service->getParent()->getCertificationHashes()) == true)
                {
                        int rv = 0;
                                aid, service->getParent()->getCertificationHashes()) == true)
                {
                        int rv = 0;
-                       ByteArray command;
-                       ByteArray response;
 
                        /* select aid */
 
                        /* select aid */
-                       command = APDUHelper::generateAPDU(APDUHelper::COMMAND_SELECT_BY_DF_NAME, channelNum, aid);
-                       rv = channel->transmitSync(command, response);
-                       if (rv == 0 && response.getLength() >= 2)
+                       if (aid == PKCS15::PKCS15_AID)
                        {
                        {
-                               ResponseHelper resp(response);
+                               PKCS15 pkcs15(channel);
 
 
-                               if (resp.getStatus() == 0)
+                               if (pkcs15.isClosed() == false)
                                {
                                {
-                                       channel->selectResponse = response;
                                        /* remove privilege mode */
                                        channel->unsetPrivilegeMode();
                                }
                                else
                                {
                                        /* remove privilege mode */
                                        channel->unsetPrivilegeMode();
                                }
                                else
                                {
-                                       SCARD_DEBUG_ERR("status word [%d][ %02X %02X ]", resp.getStatus(), resp.getSW1(), resp.getSW2());
+                                       SCARD_DEBUG_ERR("select failed");
+
+                                       service->closeChannel(result);
+                                       result = IntegerHandle::INVALID_HANDLE;
                                }
                        }
                        else
                        {
                                }
                        }
                        else
                        {
-                               SCARD_DEBUG_ERR("select apdu is failed, rv [%d], length [%d]", rv, response.getLength());
+                               FileObject file(channel);
+
+                               rv = file.select(aid);
+                               if (rv == FileObject::SUCCESS)
+                               {
+                                       /* remove privilege mode */
+                                       channel->unsetPrivilegeMode();
+                               }
+                               else
+                               {
+                                       SCARD_DEBUG_ERR("select failed [%d]", rv);
+
+                                       service->closeChannel(result);
+                                       result = IntegerHandle::INVALID_HANDLE;
+                               }
                        }
                }
                else
                        }
                }
                else
@@ -642,7 +651,6 @@ namespace smartcard_service_api
                        result = IntegerHandle::INVALID_HANDLE;
                }
 
                        result = IntegerHandle::INVALID_HANDLE;
                }
 
-
                return result;
        }
 #endif
                return result;
        }
 #endif
@@ -843,39 +851,42 @@ namespace smartcard_service_api
 
        int ServerResource::loadSecureElements()
        {
 
        int ServerResource::loadSecureElements()
        {
-               int result;
-               void *libHandle;
-               DIR *dir = NULL;
-               struct dirent *entry = NULL;
+               int result = 0;
 
 
-               if ((dir = opendir(OMAPI_SE_PATH)) != NULL)
+               if (seLoaded == false)
                {
                {
-                       while ((entry = readdir(dir)) != NULL)
+                       DIR *dir;
+                       struct dirent *entry;
+
+                       if ((dir = opendir(OMAPI_SE_PATH)) != NULL)
                        {
                        {
-                               if (strncmp(entry->d_name, ".", 1) != 0 && strncmp(entry->d_name, "..", 2) != 0)
+                               while ((entry = readdir(dir)) != NULL)
                                {
                                {
-                                       char fullPath[1024] = { 0, };
-
-                                       /* TODO : need additional name rule :) */
+                                       if (strncmp(entry->d_name, ".", 1) != 0 &&
+                                               strncmp(entry->d_name, "..", 2) != 0)
+                                       {
+                                               char fullPath[1024];
 
 
-                                       /* open each files */
-                                       libHandle = NULL;
+                                               /* TODO : need additional name rule :) */
 
 
-                                       snprintf(fullPath, sizeof(fullPath), "%s/%s", OMAPI_SE_PATH, entry->d_name);
+                                               /* append each files */
+                                               snprintf(fullPath, sizeof(fullPath),
+                                                       "%s/%s", OMAPI_SE_PATH, entry->d_name);
 
 
-                                       SCARD_DEBUG("se name [%s]", fullPath);
+                                               SCARD_DEBUG("se name [%s]", fullPath);
 
 
-                                       result = appendSELibrary(fullPath);
+                                               result = appendSELibrary(fullPath);
+                                       }
                                }
                                }
-                       }
 
 
-                       closedir(dir);
+                               closedir(dir);
 
 
-                       result = 0;
-               }
-               else
-               {
-                       result = -1;
+                               seLoaded = true;
+                       }
+                       else
+                       {
+                               result = -1;
+                       }
                }
 
                return result;
                }
 
                return result;
@@ -883,25 +894,30 @@ namespace smartcard_service_api
 
        void ServerResource::unloadSecureElements()
        {
 
        void ServerResource::unloadSecureElements()
        {
-               size_t i;
-               map<unsigned int, Terminal *>::iterator item;
-
-               for (item = mapTerminals.begin(); item != mapTerminals.end(); item++)
+               if (seLoaded == true)
                {
                {
-                       item->second->finalize();
+                       size_t i;
+                       map<unsigned int, Terminal *>::iterator item;
 
 
-                       IntegerHandle::releaseHandle(item->first);
-               }
+                       for (item = mapTerminals.begin(); item != mapTerminals.end(); item++)
+                       {
+                               item->second->finalize();
 
 
-               mapTerminals.clear();
+                               IntegerHandle::releaseHandle(item->first);
+                       }
 
 
-               for (i = 0; i < libraries.size(); i++)
-               {
-                       if (libraries[i] != NULL)
-                               dlclose(libraries[i]);
-               }
+                       mapTerminals.clear();
 
 
-               libraries.clear();
+                       for (i = 0; i < libraries.size(); i++)
+                       {
+                               if (libraries[i] != NULL)
+                                       dlclose(libraries[i]);
+                       }
+
+                       libraries.clear();
+
+                       seLoaded = false;
+               }
        }
 
        bool ServerResource::isValidReaderHandle(unsigned int reader)
        }
 
        bool ServerResource::isValidReaderHandle(unsigned int reader)
index 4b3b5bc..3ab859c 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 
 /* standard library header */
 
 
 /* standard library header */
@@ -345,47 +345,45 @@ namespace smartcard_service_api
                switch (event)
                {
                case Terminal::NOTIFY_SE_AVAILABLE :
                switch (event)
                {
                case Terminal::NOTIFY_SE_AVAILABLE :
-                       {
-                               /* add right se reader */
-//                             if ((term = ServerResource::getInstance().getTerminal((char *)terminal)) != NULL)
-//                             {
-//                                     SCARD_DEBUG("terminal : [%s]", (char *)terminal);
+                       /* add right se reader */
+//                     if ((term = ServerResource::getInstance().getTerminal((char *)terminal)) != NULL)
+//                     {
+//                             SCARD_DEBUG("terminal : [%s]", (char *)terminal);
 //
 //
-//                                     term->initialize();
-//                             }
-//                             else
-//                             {
-//                                     SCARD_DEBUG("unknown terminal : [%s]", (char *)terminal);
-//                             }
-
-                               /* send all client to refresh reader */
-                               msg.message = msg.MSG_NOTIFY_SE_INSERTED;
-                               msg.data.setBuffer((unsigned char *)terminal, strlen((char *)terminal) + 1);
-
-                               ServerResource::getInstance().sendMessageToAllClients(msg);
-                       }
+//                             term->initialize();
+//                     }
+//                     else
+//                     {
+//                             SCARD_DEBUG("unknown terminal : [%s]", (char *)terminal);
+//                     }
+
+                       /* send all client to refresh reader */
+                       msg.message = msg.MSG_NOTIFY_SE_INSERTED;
+                       msg.data.setBuffer((unsigned char *)terminal,
+                               strlen((char *)terminal) + 1);
+
+                       ServerResource::getInstance().sendMessageToAllClients(msg);
                        break;
 
                case Terminal::NOTIFY_SE_NOT_AVAILABLE :
                        break;
 
                case Terminal::NOTIFY_SE_NOT_AVAILABLE :
-                       {
-                               /* remove right se reader */
-//                             if ((term = ServerResource::getInstance().getTerminal((char *)terminal)) != NULL)
-//                             {
-//                                     SCARD_DEBUG("terminal : [%s]", (char *)terminal);
+                       /* remove right se reader */
+//                     if ((term = ServerResource::getInstance().getTerminal((char *)terminal)) != NULL)
+//                     {
+//                             SCARD_DEBUG("terminal : [%s]", (char *)terminal);
 //
 //
-//                                     term->finalize();
-//                             }
-//                             else
-//                             {
-//                                     SCARD_DEBUG("unknown terminal : [%s]", (char *)terminal);
-//                             }
-
-                               /* send all client to refresh reader */
-                               msg.message = msg.MSG_NOTIFY_SE_REMOVED;
-                               msg.data.setBuffer((unsigned char *)terminal, strlen((char *)terminal) + 1);
-
-                               ServerResource::getInstance().sendMessageToAllClients(msg);
-                       }
+//                             term->finalize();
+//                     }
+//                     else
+//                     {
+//                             SCARD_DEBUG("unknown terminal : [%s]", (char *)terminal);
+//                     }
+
+                       /* send all client to refresh reader */
+                       msg.message = msg.MSG_NOTIFY_SE_REMOVED;
+                       msg.data.setBuffer((unsigned char *)terminal,
+                               strlen((char *)terminal) + 1);
+
+                       ServerResource::getInstance().sendMessageToAllClients(msg);
                        break;
 
                default :
                        break;
 
                default :
index da1e044..1fe84d3 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -54,12 +54,14 @@ namespace smartcard_service_api
        }
 
        ByteArray ServerSession::getATRSync()
        }
 
        ByteArray ServerSession::getATRSync()
+               throw(ErrorIO &, ErrorIllegalState &)
        {
                /* call get atr to terminal */
                return atr;
        }
 
        void ServerSession::closeSync()
        {
                /* call get atr to terminal */
                return atr;
        }
 
        void ServerSession::closeSync()
+               throw(ErrorIO &, ErrorIllegalState &)
        {
                if (isClosed() == false)
                {
        {
                if (isClosed() == false)
                {
@@ -69,6 +71,7 @@ namespace smartcard_service_api
        }
 
        void ServerSession::closeChannels()
        }
 
        void ServerSession::closeChannels()
+               throw(ErrorIO &, ErrorIllegalState &)
        {
                size_t i;
 
        {
                size_t i;
 
@@ -82,11 +85,13 @@ namespace smartcard_service_api
        }
 
        Channel *ServerSession::openBasicChannelSync(ByteArray aid)
        }
 
        Channel *ServerSession::openBasicChannelSync(ByteArray aid)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openBasicChannelSync(aid, NULL);
        }
 
        Channel *ServerSession::openBasicChannelSync(ByteArray aid, void *caller)
        {
                return openBasicChannelSync(aid, NULL);
        }
 
        Channel *ServerSession::openBasicChannelSync(ByteArray aid, void *caller)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                ServerChannel *channel = NULL;
 #if 0
        {
                ServerChannel *channel = NULL;
 #if 0
@@ -147,21 +152,25 @@ namespace smartcard_service_api
        }
 
        Channel *ServerSession::openBasicChannelSync(unsigned char *aid, unsigned int length)
        }
 
        Channel *ServerSession::openBasicChannelSync(unsigned char *aid, unsigned int length)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openBasicChannelSync(ByteArray(aid, length));
        }
 
        Channel *ServerSession::openBasicChannelSync(unsigned char *aid, unsigned int length, void *caller)
        {
                return openBasicChannelSync(ByteArray(aid, length));
        }
 
        Channel *ServerSession::openBasicChannelSync(unsigned char *aid, unsigned int length, void *caller)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openBasicChannelSync(ByteArray(aid, length), caller);
        }
 
        Channel *ServerSession::openLogicalChannelSync(ByteArray aid)
        {
                return openBasicChannelSync(ByteArray(aid, length), caller);
        }
 
        Channel *ServerSession::openLogicalChannelSync(ByteArray aid)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openLogicalChannelSync(aid, NULL);
        }
 
        Channel *ServerSession::openLogicalChannelSync(ByteArray aid, void *caller)
        {
                return openLogicalChannelSync(aid, NULL);
        }
 
        Channel *ServerSession::openLogicalChannelSync(ByteArray aid, void *caller)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                ServerChannel *channel = NULL;
 #if 0
        {
                ServerChannel *channel = NULL;
 #if 0
@@ -247,11 +256,13 @@ namespace smartcard_service_api
        }
 
        Channel *ServerSession::openLogicalChannelSync(unsigned char *aid, unsigned int length)
        }
 
        Channel *ServerSession::openLogicalChannelSync(unsigned char *aid, unsigned int length)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openLogicalChannelSync(ByteArray(aid, length), NULL);
        }
 
        Channel *ServerSession::openLogicalChannelSync(unsigned char *aid, unsigned int length, void *caller)
        {
                return openLogicalChannelSync(ByteArray(aid, length), NULL);
        }
 
        Channel *ServerSession::openLogicalChannelSync(unsigned char *aid, unsigned int length, void *caller)
+               throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openLogicalChannelSync(ByteArray(aid, length), caller);
        }
        {
                return openLogicalChannelSync(ByteArray(aid, length), caller);
        }
index 3643311..94979dd 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 
 
 /* standard library header */
 
index 666d4b7..9787ed7 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef CLIENTINSTANCE_H_
 #define CLIENTINSTANCE_H_
 
 #ifndef CLIENTINSTANCE_H_
 #define CLIENTINSTANCE_H_
index bcb8bd6..aecef89 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SERVERCHANNEL_H_
 #define SERVERCHANNEL_H_
 
 #ifndef SERVERCHANNEL_H_
 #define SERVERCHANNEL_H_
@@ -41,8 +40,10 @@ namespace smartcard_service_api
                void unsetPrivilegeMode() { this->privilege = false; }
 
        protected:
                void unsetPrivilegeMode() { this->privilege = false; }
 
        protected:
-               void closeSync();
-               int transmitSync(ByteArray command, ByteArray &result);
+               void closeSync()
+                       throw(ErrorIO &, ErrorIllegalState &);
+               int transmitSync(ByteArray command, ByteArray &result)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
 
        public:
                ~ServerChannel();
 
        public:
                ~ServerChannel();
index 7f3f9a8..785860f 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SERVERDISPATCHER_H_
 #define SERVERDISPATCHER_H_
 
 #ifndef SERVERDISPATCHER_H_
 #define SERVERDISPATCHER_H_
index c1b6556..a1f7b70 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SERVERIPC_H_
 #define SERVERIPC_H_
 
 #ifndef SERVERIPC_H_
 #define SERVERIPC_H_
index 523300f..307473a 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SERVERREADER_H_
 #define SERVERREADER_H_
 
 #ifndef SERVERREADER_H_
 #define SERVERREADER_H_
@@ -44,19 +43,21 @@ namespace smartcard_service_api
                AccessControlList *acList;
 
                ServerReader(ServerSEService *seService, char *name, Terminal *terminal);
                AccessControlList *acList;
 
                ServerReader(ServerSEService *seService, char *name, Terminal *terminal);
+               ~ServerReader();
 
                int openSession(openSessionCallback callback, void *userData) { return -1; }
                int openSession(void *caller, openSessionCallback callback, void *userData) { return -1; }
 
        public:
 
                int openSession(openSessionCallback callback, void *userData) { return -1; }
                int openSession(void *caller, openSessionCallback callback, void *userData) { return -1; }
 
        public:
-               ~ServerReader();
-
-               void closeSessions();
+               void closeSessions()
+                       throw(ErrorIO &, ErrorIllegalState &);
 
                AccessControlList *getAccessControlList();
 
 
                AccessControlList *getAccessControlList();
 
-               ServerSession *openSessionSync();
-               ServerSession *openSessionSync(vector<ByteArray> &certHashes, void *caller);
+               ServerSession *openSessionSync()
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+               ServerSession *openSessionSync(vector<ByteArray> &certHashes, void *caller)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
 
                friend class ServerSEService;
        };
 
                friend class ServerSEService;
        };
index f30b9f5..0f345d8 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SERVERRESOURCE_H_
 #define SERVERRESOURCE_H_
 
 #ifndef SERVERRESOURCE_H_
 #define SERVERRESOURCE_H_
@@ -70,6 +69,7 @@ namespace smartcard_service_api
                void *mainLoop;
                ServerIPC *serverIPC;
                ServerDispatcher *serverDispatcher;
                void *mainLoop;
                ServerIPC *serverIPC;
                ServerDispatcher *serverDispatcher;
+               bool seLoaded;
 
                ServerResource();
                ~ServerResource();
 
                ServerResource();
                ~ServerResource();
index 1ae9301..7e459c1 100644 (file)
@@ -1,18 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SERVERSESERVICE_H_
 #define SERVERSESERVICE_H_
 
 #ifndef SERVERSESERVICE_H_
 #define SERVERSESERVICE_H_
index 45b6368..eb0767b 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SERVERSESSION_H_
 #define SERVERSESSION_H_
 
 #ifndef SERVERSESSION_H_
 #define SERVERSESSION_H_
@@ -55,20 +54,31 @@ namespace smartcard_service_api
        public:
                ~ServerSession();
 
        public:
                ~ServerSession();
 
-               ByteArray getATRSync();
-               void closeSync();
-
-               void closeChannels();
-
-               Channel *openBasicChannelSync(ByteArray aid);
-               Channel *openBasicChannelSync(unsigned char *aid, unsigned int length);
-               Channel *openBasicChannelSync(ByteArray aid, void *caller);
-               Channel *openBasicChannelSync(unsigned char *aid, unsigned int length, void *caller);
-
-               Channel *openLogicalChannelSync(ByteArray aid);
-               Channel *openLogicalChannelSync(unsigned char *aid, unsigned int length);
-               Channel *openLogicalChannelSync(ByteArray aid, void *caller);
-               Channel *openLogicalChannelSync(unsigned char *aid, unsigned int length, void *caller);
+               ByteArray getATRSync()
+                       throw(ErrorIO &, ErrorIllegalState &);
+               void closeSync()
+                       throw(ErrorIO &, ErrorIllegalState &);
+
+               void closeChannels()
+                       throw(ErrorIO &, ErrorIllegalState &);
+
+               Channel *openBasicChannelSync(ByteArray aid)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+               Channel *openBasicChannelSync(unsigned char *aid, unsigned int length)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+               Channel *openBasicChannelSync(ByteArray aid, void *caller)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+               Channel *openBasicChannelSync(unsigned char *aid, unsigned int length, void *caller)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+
+               Channel *openLogicalChannelSync(ByteArray aid)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+               Channel *openLogicalChannelSync(unsigned char *aid, unsigned int length)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+               Channel *openLogicalChannelSync(ByteArray aid, void *caller)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
+               Channel *openLogicalChannelSync(unsigned char *aid, unsigned int length, void *caller)
+                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &);
 
                friend class ServerReader;
                friend class ServerResource;
 
                friend class ServerReader;
                friend class ServerResource;
index 277ae4e..51f7a77 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef SERVICEINSTANCE_H_
 #define SERVICEINSTANCE_H_
 
 #ifndef SERVICEINSTANCE_H_
 #define SERVICEINSTANCE_H_
index 595b8dc..4309bab 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 /* standard library header */
 #include <stdio.h>
 
 /* standard library header */
 #include <stdio.h>
@@ -234,5 +233,8 @@ int main()
 #ifdef USE_AUTOSTART
        _finalize_dbus();
 #endif
 #ifdef USE_AUTOSTART
        _finalize_dbus();
 #endif
+       /* release secure element.. (pure virtual function problem..) */
+       ServerResource::getInstance().unloadSecureElements();
+
        return 0;
 }
        return 0;
 }
index 5a301a4..1dcbee0 100644 (file)
@@ -1,6 +1,9 @@
 <manifest>
        <define>
                <domain name="smartcard-service" />
 <manifest>
        <define>
                <domain name="smartcard-service" />
+               <request>
+                       <smack request="sys-assert::core" type="rwxat" />
+               </request>
        </define>
        <assign>
                <filesystem path="/usr/bin/smartcard-daemon" exec_label="nfc-manager" />
        </define>
        <assign>
                <filesystem path="/usr/bin/smartcard-daemon" exec_label="nfc-manager" />
index 0fc3b91..42b40b7 100644 (file)
@@ -26,7 +26,7 @@ MESSAGE("CHECK MODULE in ${PROJECT_NAME} ${pkgs_test_client_LDFLAGS}")
 # this for NFC flag
 
 SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs  -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden")
 # this for NFC flag
 
 SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs  -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden")
-SET(ARM_CXXFLAGS "${ARM_CXXLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fPIC")
+SET(ARM_CXXFLAGS "${ARM_CXXLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -Uarm -fno-common -fpic")
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
index f95b26e..69bb32e 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>
index e7a579f..1f6c14f 100644 (file)
@@ -1,19 +1,18 @@
 /*
 /*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>