convert Byte Array to Secret Key

You need to use the new keyword to call the constructor and create the object. SecretKey originalKey = new SecretKeySpec(encodedKey, 0, encodedKey.length, “AES”); When you try to call it without new, the compiler thinks it might be a method you’ve defined inside that class, hence your error message.

How to store a secret API key in an application’s binary?

There is no real perfect solution. No matter what you do, someone dedicated to it will be able to steal it. Even Twitter for iPhone/iPad/Android/mac/etc. has a secret key in there, they’ve likely just obscured it somehow. For example, you could break it up into different files or strings, etc. Note: Using a hex editor … Read more

How to hide .env passwords in Laravel whoops output?

As of Laravel 5.5.13, you can censor variables by listing them under the key debug_blacklist in config/app.php. When an exception is thrown, whoops will mask these values with asterisks * for each character. For example, given this config/app.php return [ // … ‘debug_blacklist’ => [ ‘_ENV’ => [ ‘APP_KEY’, ‘DB_PASSWORD’, ‘REDIS_PASSWORD’, ‘MAIL_PASSWORD’, ‘PUSHER_APP_KEY’, ‘PUSHER_APP_SECRET’, ], … Read more

How do API Keys and Secret Keys work? Would it be secure if I have to pass my API and secret keys to another application?

Basically elaborating on what’s outlined here. Here’s how it works: let’s say we have a function that takes a number from zero through nine, adds three and, if the result is greater than ten, subtracts ten. So f(2) = 5, f(8) = 1, etc. Now, we can make another function, call it f’, that goes … Read more