Example #1
0
 protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int code)
 {
     if (authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_CERTIFICATE_X509)
     {
         mContext = ApplicationContext;
         sbyte[] myAppKey = getApplicationCertificate(mContext);
         if (authToken.Key != null)
         {
             bool matched = true;
             if (authToken.Key.length != myAppKey.Length)
             {
                 matched = false;
             }
             else
             {
                 for (int i = 0; i < authToken.Key.length; i++)
                 {
                     if (authToken.Key[i] != myAppKey[i])
                     {
                         matched = false;
                     }
                 }
             }
             if (matched)
             {
                 Log.d(TAG, "onAuthenticationResponse : authentication is matched");
                 acceptServiceConnectionRequest(peerAgent);
                 mHandler.post(() =>
                 {
                     Toast.makeText(BaseContext, [email protected], Toast.LENGTH_SHORT).show();
                 });
             }
         }
     }
     else if (authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_NONE)
     {
         Log.e(TAG, "onAuthenticationResponse : CERT_TYPE(NONE)");
     }
 }
 protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int error)
 {
     /*
      * The authenticatePeerAgent(peerAgent) API may not be working properly depending on the firmware
      * version of accessory device. Please refer to another sample application for Security.
      */
 }
		protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int error)
		{
			/*
			 * The authenticatePeerAgent(peerAgent) API may not be working properly depending on the firmware
			 * version of accessory device. Please refer to another sample application for Security.
			 */
		}
		protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int code)
		{
			if (code == SAAgent.AUTHENTICATION_SUCCESS && authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_CERTIFICATE_X509)
			{
				requestServiceConnection(peerAgent);
			}
		}
 protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int code)
 {
     if (code == SAAgent.AUTHENTICATION_SUCCESS && authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_CERTIFICATE_X509)
     {
         requestServiceConnection(peerAgent);
     }
 }
		protected internal override void onAuthenticationResponse(SAPeerAgent peerAgent, SAAuthenticationToken authToken, int code)
		{
			if (authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_CERTIFICATE_X509)
			{
				mContext = ApplicationContext;
				sbyte[] myAppKey = getApplicationCertificate(mContext);
				if (authToken.Key != null)
				{
					bool matched = true;
					if (authToken.Key.length != myAppKey.Length)
					{
						matched = false;
					}
					else
					{
						for (int i = 0; i < authToken.Key.length; i++)
						{
							if (authToken.Key[i] != myAppKey[i])
							{
								matched = false;
							}
						}
					}
					if (matched)
					{
						Log.d(TAG, "onAuthenticationResponse : authentication is matched");
						acceptServiceConnectionRequest(peerAgent);
						mHandler.post(() =>
						{
							Toast.makeText(BaseContext, [email protected], Toast.LENGTH_SHORT).show();
						});
					}
				}
			}
			else if (authToken.AuthenticationType == SAAuthenticationToken.AUTHENTICATION_TYPE_NONE)
			{
				Log.e(TAG, "onAuthenticationResponse : CERT_TYPE(NONE)");
			}
		}