Showing posts with label security. Show all posts
Showing posts with label security. Show all posts

Wednesday, October 12, 2016

macOS Sierra - Allowing apps from anywhere to run (disabling GateKeeper)

In macOS Sierra, GateKeeper by default will no longer allow you to execute apps that are not from the App Store. Even if you go to the System Preferences | Security & Privacy | General page, you no longer have the option Anywhere:


For example, recently I downloaded the UnRarX app directly from the developer's web site and macOS Sierra does not allow me to run it even when I click the Open Anyway button (see above).

To fix this, you can use the following command in Terminal:

udo spctl --master-disable

Once you run this command, the Anywhere will now appear in the System Preferences | Security & Privacy | General page.

Sunday, January 24, 2016

IOS305 – 1-Day Developing Secure iOS Applications

In this one-day course, you will learn how to write secure iOS applications. You will learn how to save user data securely on your iPhone, and how to perform authentication within your application using custom authentication and using Apple’s Touch ID.

You will learn:
Implementing local authentication on your application
Using Touch ID for authentication
Cryptography in iOS
       o Hashing
       o Symmetric and Asymmetric Encryption/Decryption
Saving passwords in Keychain
Saving Keychain data on iCloud
Sharing Keychain with Apps made by your team
Obtaining Passwords from the user
Connecting to a secure REST API service
iOS File system Security

Security Best Practices
IOS305 - Advanced iOS - Developing Secure iOS Apps
Course Fee
S$799 (nett; no GST)
If your company is sponsoring you for the training, your company can enjoy 400% tax deductions/ allowances and/or 60% cash payout for investment in innovation and productivity improvements under the Productivity and Innovation Credit (PIC) scheme. For more details, check out the Productivity and Innovation Credit page. 
Schedules
Start DateEnd DateDetailsCategory
Fri Apr 01 2016Fri Apr 01 2016PDF
Venue
Bayview Hotel Singapore
30 Bencoolen Street
Singapore 189621 

Sunday, March 30, 2014

Android Tip - Notification Listener Service

Android 4.3 introduces a new API called the Notification Listener Service.  Its main function is to let applications have the ability to be notified when notifications are posted or removed from the system. A good example use of this is the Android Wear application, which receives all the notifications posted on your Android device and routes them to your Android Wear device.

To create a notification, you can use the NotificationCompat.Builder class:

    //---create a notification---
    Notification notification = new
        NotificationCompat.Builder(this)   
            .setSmallIcon(R.drawable.ic_launcher)
            .setContentTitle("Notification Title")
            .setContentText("Notification Message")
            .setTicker("Ticker Text")
            .setAutoCancel(true)       
            .setNumber(1)
            .build();
       
    //---set the sound and lights---
    notification.defaults |=
        Notification.DEFAULT_SOUND;
    notification.defaults |=
        Notification.DEFAULT_LIGHTS;

To post a notification on your Android device, you can use the NotificationManager class’s notify() method, passing it a tag, notification ID, as well as the Notification object:
       
    NotificationManager notificationManager;  
    int notificationID = 0;

    //---display the notification---
    notificationManager.notify("tag",
        notificationID++, notification);   

To listen for notifications posted on the Android device, you need to create a new class that extends the NotificationListenerService base class:

package net.learn2develop.notificationservice;

import
    android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;

public class NotificationListener extends
    NotificationListenerService {

    @Override
    public void onNotificationPosted(
        StatusBarNotification sbn) {
        //---show current notification---
        Log.i("","---Current Notification---");
        Log.i("","ID :" + sbn.getId() + "\t" +
            sbn.getNotification().tickerText + "\t" +
            sbn.getPackageName());
        Log.i("","--------------------------");

        //---show all active notifications---
        Log.i("","===All Notifications===");
        for (StatusBarNotification notif :
            this.getActiveNotifications()) {           
            Log.i("","ID :" + notif.getId() + "\t" +
                notif.getNotification().tickerText + "\t" +
                notif.getPackageName());
        }
        Log.i("","=======================");       
    }

    @Override
    public void onNotificationRemoved(
        StatusBarNotification sbn) {
        Log.i("","---Notification Removed---");
        Log.i("","ID :" + sbn.getId() + "\t" +
            sbn.getNotification().tickerText + "\t" +
            sbn.getPackageName());
        Log.i("","--------------------------");
       
    }   
}

You need to override two methods in this class:
·       onNotificationPosted() – called when a notification is received by the system
·       onNotificationRemoved() – called when a notification is removed

For these two methods, an instance of the StatusBarNotification class will be passed in, allowing you to know which application posted the notification, its content, id, etc.

Within the service, you can also list all the notifications currently available in the notification bar by using the getActiveNotifications() method. You can also remove a particular notification by using the cancelNotification() method, passing it the package name of the application that posted the notification, the tag of the notification, as well as its notification id:

    this.cancelNotification(
        notif.getPackageName(),
        notif.getTag(),
        notif.getId());

To remove all notifications, use the cancelAllNotifications() method:

    //---remove all notifications---       
    this.cancelAllNotifications();

Finally, you need to declare your service in the AndroidManifest.xml file:

<service android:name=".NotificationListener"
    android:label="@string/app_name"
    android:permission=        
    "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
    <intent-filter>
        <action android:name=
 "android.service.notification.NotificationListenerService" />
    </intent-filter>
</service>

When the application is installed on the device, the user must explicitly give permission to your app to listen for notifications on the system. They need to do so via the Notification access page at: Settings | Security | Notification access: