Saturday, June 24, 2017

Instagram Live Replays, Periscope Super Hearts, Snap Map, and Pinterest Lens Camera Updates

Welcome to this week’s edition of the Social Media Marketing Talk Show, a news show for marketers who want to stay on the leading edge of social media. On this week’s Social Media Marketing Talk Show with Erik Fisher and Kim Reynolds, we explore Instagram live replays with Jeff Sieh, Periscope super hearts with Luria [...]

This post Instagram Live Replays, Periscope Super Hearts, Snap Map, and Pinterest Lens Camera Updates first appeared on .
- Your Guide to the Social Media Jungle


by Grace Duffy via

Friday, June 23, 2017

The Ultimate Guide to Micro-Influencers [INFOGRAPHIC]

If you are into online marketing, it is likely that you are already aware of influencer marketing by now. They play a strong role in establishing the brand image of a company. But at the same time, these influencers are quite expensive and their rates do not fit into the budget of smaller...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Irfan Ahmad via Digital Information World

Key Guidelines to Continuous Integration and Jenkins CI Server

This article was originally published on TestProject — Test Automation Blog. Looking for more on Jenkins and continuous integration? Check out these great links: Screencast: Which Continuous Integration Tools Support Bitbucket? Preparing and Building a PHP Project in Jenkins Continuous Integration with Jenkins Re-Introducing Jenkins: Automated Testing with Pipelines Installing and Securing Jenkins Modern software […]

Continue reading %Key Guidelines to Continuous Integration and Jenkins CI Server%


by Bakir Jusufbegovic via SitePoint

Hello, Laravel? Communicating with PHP through SMS!

In this article, we will modify our Laravel-powered phone-capable weather forecast app so that it is accessible via SMS (text message) in addition to the voice telephone system. It is recommended you read the previous post if you haven't done so yet - it's a 10 minute read for an excellent outcome.

Note: If you're confused by the development environment we're using, it's Homestead Improved and you can learn more about it here, or go in detail by buying our book about PHP environments.

Vector icon of phone with weather icon overlaid

Adding Routes

To allow for SMS communication, we need some more routes. Open up the routes/web.php file and append the following code to it:

Route::group(['prefix' => 'sms', 'middleware' => 'twilio'], function () {
    Route::post('weather', 'SmsController@showWeather')->name('weather');
});

The prefix for the route is sms, so that routes will have a path like /sms/weather, as the one in the example. This is the only route we need for SMS, as Twilio will call the same route over and over again. Twilio will access it via HTTP POST. We could also do this without the prefix, but it's more flexible this way if we decide to add more functionality to the SMS side later.

Service Layer

Next, we'll modify the service we wrote previously. Open up the app/Services/WeatherService.php file and remove the current getWeather method, then replace it with the one below:

    public function getWeather($zip, $dayName, $forSms = false)
    {

        $point = $this->getPoint($zip);
        $tz = $this->getTimeZone($point);
        $forecast = $this->retrieveNwsData($zip);
        $ts = $this->getTimestamp($dayName, $zip);

        $tzObj = new \DateTimeZone($tz->timezoneId);

        $tsObj = new \DateTime(null, $tzObj);
        $tsObj->setTimestamp($ts);

        foreach ($forecast->properties->periods as $k => $period) {
            $startTs = strtotime($period->startTime);
            $endTs = strtotime($period->endTime);

            if ($ts > $startTs and $ts < $endTs) {
                $day = $period;
                break;
            }
        }

        $weather = $day->name;
        $weather .= ' the ' . $tsObj->format('jS') . ': ';

        $response = new Twiml();

        if ($forSms) {
            $remainingChars = 140 - strlen($weather);

            if (strlen($day->detailedForecast) > $remainingChars) {
                $weather .= $day->shortForecast;
                $weather .= '. High of ' . $day->temperature . '. ';
                $weather .= $day->windDirection;
                $weather .= ' winds of ' . $day->windSpeed;
            } else {
                $weather .= $day->detailedForecast;
            }

            $response->message($weather);
        } else {
            $weather .= $day->detailedForecast;

            $gather = $response->gather(
                [
                    'numDigits' => 1,
                    'action' => route('day-weather', [], false)
                ]
            );

            $menuText = ' ';
            $menuText .= "Press 1 for Sunday, 2 for Monday, 3 for Tuesday, ";
            $menuText .= "4 for Wednesday, 5 for Thursday, 6 for Friday, ";
            $menuText .= "7 for Saturday. Press 8 for the credits. ";
            $menuText .= "Press 9 to enter in a new zipcode. ";
            $menuText .= "Press 0 to hang up.";

            $gather->say($weather . $menuText);
        }

        return $response;
    }

This function is very similar to the old one. The only difference is that it takes into consideration that the weather request might be coming form a telephone device via SMS, so it makes sure that the weather forecast isn't too long and tries to limit it to less than 140 characters. The response for SMS is still TwiML, just formatted for SMS.

Continue reading %Hello, Laravel? Communicating with PHP through SMS!%


by Christopher Thomas via SitePoint

#340: Using JavaScript for Microcontroller Development

This week's JavaScript newsRead this e-mail on the Web
JavaScript Weekly
Issue 340 — June 23, 2017
Learn about your options for running JavaScript on microcontrollers and IoT platforms.
Sebastián Peyrott

A modern ES6 update to a very popular demo from 2013 which implemented a working spreadsheet in very few lines of JS.
Ondřej Žára

A developer at Automattic (the company behind WordPress) explains why they prefer Jest to Mocha for JavaScript testing.
Grzegorz Ziółkowski

CircleCI
CircleCI’s continuous integration and delivery platform helps software teams rapidly release code with confidence. NEW RELEASE: Workflows - Custom job orchestration provides granular control over your development process.
CircleCI   Sponsor

An intriguing new approach to creating a simple front-end app where you write the entire app mostly declaratively in a single JS object.
Intercellular

An opinionated, all-in-one guide walking through create-react-app, webpack, Babel, ES2015+, JSX, Redux, CSS-in-JS, and more.
Devin Abbott

An introduction to the idea of using Facebook’s jscodeshift to create and apply ‘codemods’ to automate changes to your code.
Chris Laughlin

Jobs Supported by Hired.com

Can't find the right job? Want companies to apply to you? Try Hired.com.

In Brief

The State of Angular and the Due Date of Version 5 news
Dor Moshe

Register for M101JS: MongoDB for Node.js Developers 
Learn everything you need to know to get started building a MongoDB-based app.
MONGODB  Sponsor

Creating a Personal Bluetooth Beacon with Puck.js tutorial
Adam Butler

Unambiguous Webpack Config with TypeScript tutorial
Devon Marisa Zuegel

The Art of Building a Progressive Web App with Ember tutorial
Matthew Beale

A Through (Re)Introduction to Callbacks tutorial
A thorough guide aimed at newbies/learners.
Zell Liew

A Brief Guide to Reliable Stream Processing with RxJS tutorial
Hendrik Swanepoel

How to Create Interactive JavaScript Charts from Custom Data Sets tutorial
SitePoint

An Introduction to Sets in JavaScript tutorial
Alligator

Techniques for Decomposing React Components tutorial
David Tang

Introducing Lazy Arrays in JavaScript with lazy-arr tutorial
PerformanceJS

ForwardJS Tickets on sale today 
Attend full-day hands-on React workshops and dozens of talks at ForwardJS San Francisco this July.
ForwardJS  Sponsor

ES2017's async/await is 'The Best Thing to Ever Happen to JavaScript' opinion
Mike MacCana

Functional Programming in JS is an Antipattern opinion
Here’s your thought provoking opinion piece of the week.
Alex Dixon

Why One Developer Chose React Over Vue opinion
He prefers immutability and using JS instead of directives.
Steven Poulton

Making the Switch from AngularJS to Angular in an Enterprise Dev Shop story
Telerik Developer Network

jQuery-contextMenu: A jQuery Context Menu Plugin and Polyfill code
SWIS

Spected: A Low Level Validation Library for Objects code
25th-floor GmbH

Tetris Reimplemented with Vue, Vuex, and Immutable.js code
An interesting implementation that’s very smooth to play.
Binaryify

p-iteration: Make Array Iteration Easy with async/await and Promises code
Antonio V

vue-table-component: A Vue Component to Filter and Sort Tables code
Freek Van der Herten

How to find & fix the slowest code in your .NET application with Redgate 
Red Gate  Sponsor

Curated by Peter Cooper and published by Cooperpress.

Like this? You may also enjoy: FrontEnd Focus : Node Weekly : React Status

Stop getting JavaScript Weekly : Change email address : Read this issue on the Web

© Cooperpress Ltd. Office 30, Lincoln Way, Louth, LN11 0LS, UK


by via JavaScript Weekly

Only

Only

'Only' is a One Page WordPress theme suited for a freelancer portfolio. Features include (trendy) diagonal lines, card-style elements, an off-canvas navigation menu, big image slider pop-up portfolio section, blog feed, team and a newsletter sign up box. This is Dessign's follow up to their popular Page Down theme.

by Rob Hope via One Page Love

Securing iOS Data at Rest: Encryption

In this post, we'll look at advanced uses of encryption for user data in iOS apps. We'll start with a high-level look at AES encryption, and then go on to look at some examples of how to implement AES encryption in Swift.

In the last post, you learned how to store data using the keychain, which is good for small pieces of information such as keys, passwords, and certificates. 

  • iOS SDK
    Securing iOS Data at Rest: The Keychain
    Collin Stuart

If you are storing a large amount of custom data that you want to be available only after the user or device authenticates, then it's better to encrypt the data using an encryption framework. For example, you may have an app that can archive private chat messages saved by the user or private photos taken by the user, or which can store the user's financial details. In these cases, you would probably want to use encryption.

There are two common flows in applications for encrypting and decrypting data from iOS apps. Either the user is presented with a password screen, or the application is authenticated with a server which returns a key to decrypt the data. 

It's never a good idea to reinvent the wheel when it comes to encryption. Therefore, we are going to use the AES standard provided by the iOS Common Crypto library.

AES

AES is a standard that encrypts data given a key. The same key used to encrypt the data is used to decrypt the data. There are different key sizes, and AES256 (256 bits) is the preferred length to be used with sensitive data.

RNCryptor is a popular encryption wrapper for iOS that supports AES. RNCryptor is a great choice because it gets you up and running very quickly without having to worry about the underlying details. It is also open source so that security researchers can analyze and audit the code.  

On the other hand, if your app deals with very sensitive information and you think your application will be targeted and cracked, you may want to write your own solution. The reason for this is that when many apps use the same code, it can make the hacker's job easier, allowing them to write a cracking app that finds common patterns in the code and applies patches to them. 

Keep in mind, though, that writing your own solution only slows down an attacker and prevents automated attacks. The protection you are getting from your own implementation is that a hacker will need to spend time and dedication on cracking your app alone. 

Whether you choose a third-party solution or choose to roll your own, it's important to be knowledgeable about how encryption systems work. That way, you can decide if a particular framework you want to use is really secure. Therefore, the rest of this tutorial will focus on writing your own custom solution. With the knowledge you'll learn from this tutorial, you'll be able to tell if you're using a particular framework securely. 

We'll start with the creation of a secret key that will be used to encrypt your data.

Create a Key

A very common error in AES encryption is to use a user's password directly as the encryption key. What if the user decides to use a common or weak password? How do we force users to use a key that is random and strong enough (has enough entropy) for encryption and then have them remember it? 

The solution is key stretching. Key stretching derives a key from a password by hashing it many times over with a salt. The salt is just a sequence of random data, and it is a common mistake to omit this salt—the salt gives the key its vitally important entropy, and without the salt, the same key would be derived if the same password was used by someone else.

Without the salt, a dictionary of words could be used to deduce common keys, which could then be used to attack user data. This is called a "dictionary attack". Tables with common keys that correspond to unsalted passwords are used for this purpose. They're called "rainbow tables".

Another pitfall when creating a salt is to use a random number generating function that was not designed for security. An example is the rand() function in C, which can be accessed from Swift. This output can end up being very predictable! 

To create a secure salt,  we will use the function SecRandomCopyBytes to create cryptographically secure random bytes—which is to say, numbers that are difficult to predict. 

To use the code, you'll need to add the following into your bridging header:
#import <CommonCrypto/CommonCrypto.h>

Here is the start of the code that creates a salt. We will add to this code as we go along:

Now we are ready to do key stretching. Fortunately, we already have a function at our disposal to do the actual stretching: the Password-Based Key Derivation Function (PBKDF2). PBKDF2 performs a function many times over to derive the key; increasing the number of iterations expands the time it would take to operate on a set of keys during a brute force attack. It is recommended to use PBKDF2 to generate your key.

Server-Side Key

You may be wondering now about the cases where you don't want to require users to provide a password within your app. Perhaps they are already authenticating with a single sign-on scheme. In this case, have your server generate an AES 256-bit (32 byte) key using a secure generator. The key should be different for different users or devices. On authenticating with your server, you can pass the server a device or user ID over a secure connection, and it can send the corresponding key back. 

This scheme has a major difference. If the key is coming from the server, the entity that controls that server has the capacity to be able to read the encrypted data if the device or data were ever obtained. There is also the potential for the key to be leaked or exposed at a later time. 

On the other hand, if the key is derived from something only the user knows—the user's password—then only the user can decrypt that data. If you are protecting information such as private financial data, only the user should be able to unlock the data. If that information is known to the entity anyway, it may be acceptable to have the server unlock the content via a server-side key.

Modes and IVs

Now that we have a key, let's encrypt some data. There are different modes of encryption, but we'll be using the recommended mode: cipher block chaining (CBC). This operates on our data one block at a time. 

A common pitfall with CBC is the fact that each next unencrypted block of data is XOR’d with the previous encrypted block to make the encryption stronger. The problem here is that the first block is never as unique as all the others. If a message to be encrypted were to start off the same as another message to be encrypted, the beginning encrypted output would be the same, and that would give an attacker a clue to figuring out what the message might be. 

To get around this potential weakness, we'll start the data to be saved with what is called an initialization vector (IV): a block of random bytes. The IV will be XOR’d with the first block of user data, and since each block depends on all blocks processed up until that point, it will ensure that the entire message will be uniquely encrypted, even if it has the same data as another message. In other words, identical messages encrypted with the same key will not produce identical results. So while salts and IVs are considered public, they should not be sequential or reused. 

We will use the same secure SecRandomCopyBytes function to create the IV.

Putting It All Together

To complete our example, we'll use the CCCrypt function with either kCCEncrypt or kCCDecrypt. Because we are using a block cipher, if the message doesn’t fit nicely into a multiple of the block size, we will need to tell the function to automatically add padding to the end. 

As usual in encryption, it is best to follow established standards. In this case, the standard PKCS7 defines how to pad the data. We tell our encryption function to use this standard by supplying the KCCOptionPKCS7Padding option. Putting it all together, here is the full code to encrypt and decrypt a string.

And here is the decryption code:

Finally, here is a test to ensure that data is decrypted correctly after encryption:

In our example, we package all the necessary information and return it as a Dictionary so that all the pieces can later be used to successfully decrypt the data. You only need to store the IV and salt, either in the keychain or on your server.

Conclusion

This completes the three-part series on securing data at rest. We have seen how to properly store passwords, sensitive pieces of information, and large amounts of user data. These techniques are the baseline for protecting stored user information in your app.

It is a huge risk when a user's device is lost or stolen, especially with recent exploits to gain access to a locked device. While many system vulnerabilities are patched with a software update, the device itself is only as secure as the user's passcode and version of iOS. Therefore it is up to the developer of each app to provide strong protection of sensitive data being stored. 

All of the topics covered so far make use of Apple's frameworks. I will leave an idea with you to think about. What happens when Apple's encryption library gets attacked? 

When one commonly used security architecture is compromised, all of the apps that rely on it are also compromised. Any of iOS's dynamically linked libraries, especially on jailbroken devices, can be patched and swapped with malicious ones. 

However, a static library that is bundled with the binary of your app is protected from this kind of attack because if you try and patch it, you end up changing the app binary. This will break the code signature of the app, preventing it from being launched. If you imported and used, for example, OpenSSL for your encryption, your app would not be vulnerable to a widespread Apple API attack. You can compile OpenSSL yourself and statically link it into your app.

So there is always more to learn, and the future of app security on iOS is always evolving. The iOS security architecture even now supports cryptographic devices and smart cards! In closing, you now know the best practices for securing data at rest, so it's up to you to follow them!

In the meantime, check out some of our other content about iOS app development and app security.

  • Security
    How to Hack Your Own App
    Tanya Janca
  • iOS
    Go Further With Swift: Animation, Networking, and Custom Controls
    Markus Mühlberger
  • Swift
    Swift From Scratch: Delegation and Properties
    Bart Jacobs

by Collin Stuart via Envato Tuts+ Code