You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
849 B
21 lines
849 B
<?php
|
|
|
|
namespace utils;
|
|
|
|
class keygen {
|
|
|
|
public static function ed25519(string $file, string $pwd = "", string $comment = "") {
|
|
exec(\neato::get_user_bin . 'ssh-keygen -t ed25519 -f ' . safe_cmd($file) . ' -N \'' . safe_cmd($pwd) . '\' -C \'' . safe_cmd($comment) . '\'', $output, $exit_code);
|
|
display($output);
|
|
check_for_error($exit_code, "Unable to run ssh-keygen command: {$file}");
|
|
return $exit_code;
|
|
}
|
|
|
|
public static function rsa($file, int $size = 4096, string $pwd = "", string $comment = "") {
|
|
exec(\neato::get_user_bin . 'ssh-keygen -t rsa -b '. safe_cmd($size) .' -f ' . safe_cmd($file) . ' -N \'' . safe_cmd($pwd) . '\' -C \'' . safe_cmd($comment) . '\'', $output, $exit_code);
|
|
display($output);
|
|
check_for_error($exit_code, "Unable to run ssh-keygen command: {$file}");
|
|
return $exit_code;
|
|
}
|
|
|
|
} |