How to generate "/etc/shadow ready" hash with BC?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to generate "/etc/shadow ready" hash with BC?

Ivo Petkov
Hi All,

I'm struggling with the following problem:
I have to pass MD5 salted hash with cloud-config, so I'm setting user's password.
I need the same result as :
openssl passwd -1  -salt SaltSalt  thesecretpasword
$1$SaltSalt$zR.c1ZfVHMykGU5zYEVVm1

Can someone guide me, how to achieve this with BC Java APIs?

Thanks in advance,
Ivo 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to generate "/etc/shadow ready" hash with BC?

David Hook-3
There's a lengthy discussion on this here:

https://www.vidarholen.net/contents/blog/?p=32

The main trick is you'll need to support the crypt base64 encoding - we don't currently support that directly.

The character set for crypt base64 is given in the blog post, also take note that the format is not padded. Other than that we support the primitives required.

Regards,

David

On 21/07/17 00:37, Ivo Petkov wrote:
Hi All,

I'm struggling with the following problem:
I have to pass MD5 salted hash with cloud-config, so I'm setting user's password.
I need the same result as :
openssl passwd -1  -salt SaltSalt  thesecretpasword
$1$SaltSalt$zR.c1ZfVHMykGU5zYEVVm1

Can someone guide me, how to achieve this with BC Java APIs?

Thanks in advance,
Ivo 


Loading...