Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.

Commit

Permalink
Fix a bug in Hail
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Jun 4, 2016
1 parent ab5d481 commit 69fb45d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
33 changes: 16 additions & 17 deletions src/Engine/Hail.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,6 @@ public function get(string $url, array $params = []): ResponseInterface
);
}

/**
* Perform a GET request, get a decoded JSON response.
*
* @param string $url
* @param array $params
* @return mixed
*/
public function getJSON(string $url, array $params = [])
{
return \Airship\parseJSON(
$this->get($url, $params),
true
);
}

/**
* Perform a GET request, asynchronously
*
Expand All @@ -129,6 +114,21 @@ public function getAsync(
);
}

/**
* Perform a GET request, get a decoded JSON response.
*
* @param string $url
* @param array $params
* @return mixed
*/
public function getJSON(string $url, array $params = [])
{
return \Airship\parseJSON(
$this->getReturnBody($url, $params),
true
);
}

/**
* Perform a POST request, get the body
*
Expand All @@ -151,7 +151,6 @@ public function getReturnBody(
}
throw new TransferException();
}

/**
* Perform a GET request, get a decoded JSON response.
* Internally verifies an Ed25519 signature.
Expand Down Expand Up @@ -331,7 +330,7 @@ public function postAsync(
public function postJSON(string $url, array $params = [])
{
return \Airship\parseJSON(
$this->post($url, $params),
$this->postReturnBody($url, $params),
true
);
}
Expand Down
19 changes: 19 additions & 0 deletions tools/hangar/src/Commands/Sign.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ public function fire(array $args = []): bool
$level = KeyFactory::SENSITIVE;
break;
}
} elseif (isset($this->config['keytype'])) {
switch (isset($this->config['keytype'])) {
case 'fast':
case 'i':
case 'interactive':
case 'weak':
$level = KeyFactory::INTERACTIVE;
break;
case 'm':
case 'moderate':
$level = KeyFactory::MODERATE;
break;
default:
$level = KeyFactory::SENSITIVE;
break;
}
} else {
$level = KeyFactory::SENSITIVE;
}
Expand Down Expand Up @@ -75,6 +91,9 @@ public function fire(array $args = []): bool
}
\file_put_contents($file.'.sig', $signature);
echo 'File signed: ' . $file.'.sig', "\n";
echo 'Public key: ' . \Sodium\bin2hex(
$sign_kp->getPublicKey()->getRawKeyMaterial()
), "\n";
return true;
}

Expand Down

0 comments on commit 69fb45d

Please sign in to comment.