"E_INVALID_HASHER_DRIVER: Hash driver bcryptsu does not exists. > More details: https://err.sh/adonisjs/errors/E_INVALID_HASHER_DRIVER" - adonis.js

My password are not encrypt.
E_INVALID_HASHER_DRIVER: Hash driver bcryptsu does not exists. > More details: https://err.sh/adonisjs/errors/E_INVALID_HASHER_DRIVER"

I don't believe that bcryptsu exists.
Change your .env like:
...
HASH_DRIVER=bcrypt

Related

Invalid Hash Function Name on SHA2-512 when creating user

Trying to create user using from golang using library "google.golang.org/api/admin/directory/v1"
As docs sad here https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#User hashFunction could be MD5, DES, SHA2-256, SHA2-512, so i'm writing code:
hash := sha512.Sum512([]byte("random password value))
encoded := hex.EncodeToString(hash[:])
payload := &admin.User{
Password: "$6$" + encoded,
HashFunction: "SHA2-512"
}
This results: googleapi: Error 400: Invalid Hash Function Name, invalid
So how to understand, whats wrong with hash function name ?
So, i found here https://developers.google.com/resources/api-libraries/documentation/admin/directory_v1/python/latest/admin_directory_v1.users.html#insert that right now only supported SHA-1, crypt and MD5, so documentation is wrong, and for SHA2 hashes use string "crypt" as hashFunction value and add to password corresponding crypt prefix ( for example for SHA2-512 add $6$ to hex encoded value )

Extra string & pipe character in Laravel Cookies

In a Laravel 6x project I'm working on I'm setting a cookie with:
Cookie::queue('remember_me', json_encode(['uid' => $user->id, 'token' => $token]),2628000);
I'm reading the cookie and decrypting it with:
$cookies = Crypt::decrypt(Cookie::get('remember_me'),false);
This works well, except that the value of $cookies has an extra pre-pended string and a | delimiter in it:
e80cd502fec2a621b624ead8eb1cc91a2e94846b|{"uid":872,"token":"l1214065120208k"}
I can work with that obviously to get what I need but I have been unable to find anything on why that string and | are being prepended to the cookie. Any explanation or documentation link?
I did find another thread here with a similar question but no answer:
How to decrypt cookies in Laravel 8
I also found a thread suggesting that Laravel 8 adds the session_id to the cookie string. Is that what I'm seeing here?
Thanks,
Michael
This value looks to be an HMAC-SHA1 of the cookie name with v2 appended to the end.
This logic is implemented in the CookieValuePrefix class in Laravel and the code looks like so:
public static function create($cookieName, $key)
{
return hash_hmac('sha1', $cookieName.'v2', $key).'|';
}
This is used in the EncryptCookies middleware when encrypting and decrypting accordingly. The relevant source code is:
// in decrypt() function
$hasValidPrefix = strpos($value, CookieValuePrefix::create($key, $this->encrypter->getKey())) === 0;
$request->cookies->set(
$key, $hasValidPrefix ? CookieValuePrefix::remove($value) : null
);
// in encrypt() function
$this->encrypter->encrypt(
CookieValuePrefix::create($cookie->getName(), $this->encrypter->getKey()).$cookie->getValue(),
static::serialized($cookie->getName())
)
I put this logic into a CyberChef page here to test it out with some local cookies I had and verify the output matches and it did. If you go there and plug in your app key (preferable a disposable one) you should see it output the hash value you have in your question.

See if key exists in a .yml file with bukkit plugin

I want to be able to see if a specific key exists in a .yml file so I don't write the same key multiple times in the same file. Here's how it looks right now:
if (config.getString("coins","") == "") {
p.sendMessage("no coins key ):");
} else {
p.sendMessage("a coins key :D");
}
config.getString("path", "")
returns "", if the path does not exist. You should be good by checking it like that, but you should use .equals() to compare 2 strings.

Nginx Regex to check MD5 of $http_cookie name

So i map $http_cookie to check all cookies the client sends the only one i want to intercept to obtain the value of the cookie is any cookie with a MD5 HASH.
The regex to detect a MD5 hash is this
[0-9a-f]{32}
But when i add it to my map directive Nginx won't run because the regex is wrong.
This is my cookie map the issue with this is it gets all cookies i only want the ones with a MD5 sum.
map $http_cookie $session_id_value {
default '';
~^.*.+\=(?<session_value>[\w]+).*$ $session_value;
}
I try this
map $http_cookie $session_id_value {
default '';
~^.*[0-9a-f]{32}.+\=(?<session_value>[\w]+).*$ $session_value;
}
But Nginx does not like my regex. So it errors and won't run.
I test with the echo module to see the value of the cookie my regex has grabbed but currently it keeps grabbing the first random cookie not the one with a MD5 hash for a name.
echo "Session Cookie Value : $session_id_value";
echo "httpcookie : $http_cookie";
That is a syntax error. From the rewrite documentation:
If a regular expression includes the “}” or “;” characters, the whole
expressions should be enclosed in single or double quotes.
Try:
map $http_cookie $session_id_value {
default '';
"~^.*[0-9a-f]{32}.+\=(?<session_value>[\w]+).*$" $session_value;
}

Adding subjectAltName to csr using phpseclib

I am using phpseclib to generate private key, public key and CSR and i just want to be able to include subjectAltName to the Public key and CSR in the process but the documentation is no good. I tried using setDomain but all that does is overides the primary commonName value..
I found this from another post but it doesn't seem to have any effect:
$x509->setExtension('id-ce-subjectAltName', array('san1.domain.com', 'san2.domain.com'));
-- UPDATE --
I am step closer, I see the extension for subjectAltName in my certificate but its blank field
Any help will be appreciated!
thanks
Here is some php code..
$altnames = array (
"san1.domain.com",
"san2.domain.com"
);
$x509 = new File_X509();
$x509->loadX509($x509->saveX509($x509->sign($issuer, $subject)));
$x509->setExtension('id-ce-keyUsage', array('digitalSignature', 'keyEncipherment'));
$x509->setExtension('id-ce-extKeyUsage', array('id-kp-serverAuth', 'id-kp-clientAuth'));
$x509->setExtension("id-ce-subjectAltName", $altnames);
phpseclib doesn't currently support subjAltDomain's for CSR's very well. More info:
https://stackoverflow.com/a/28610388/569976