Пример #1
0
 /**
  * This function is called after the dependencies have been injected by
  * AutoPilot. Think of it as a user-land constructor.
  */
 public function airshipLand()
 {
     parent::airshipLand();
     $config = State::instance();
     if (empty($config->universal['notary']['enabled'])) {
         \Airship\json_response(['status' => 'error', 'message' => 'This Airship does not offer Notary services.']);
     }
     $this->sk = $config->keyring['notary.online_signing_key'];
     $this->pk = $this->sk->derivePublicKey();
     $this->channel = $config->universal['notary']['channel'];
     $this->chanUp = $this->blueprint('ChannelUpdates', $this->channel);
 }
Пример #2
0
 /**
  * Sign the contents of a file
  *
  * @param ReadOnlyFile $input
  * @param SignatureSecretKey $secretkey
  * @param bool $raw_binary Don't hex encode?
  * @return string
  * @throws CryptoException\InvalidKey
  */
 protected static function signData(ReadOnlyFile $input, SignatureSecretKey $secretkey, bool $raw_binary = false) : string
 {
     if (!$secretkey instanceof SignatureSecretKey) {
         throw new CryptoException\InvalidKey('Argument 1: Expected an instance of SignatureSecretKey');
     }
     $csum = self::checksumData($input, $secretkey->derivePublicKey(), true);
     return AsymmetricCrypto::sign($csum, $secretkey, $raw_binary);
 }
Пример #3
0
 /**
  * Sign the contents of a file
  *
  * @param ReadOnlyFile $input
  * @param SignatureSecretKey $secretKey
  * @param bool $raw_binary Don't hex encode?
  * @return string
  */
 protected static function signData(ReadOnlyFile $input, SignatureSecretKey $secretKey, bool $raw_binary = false) : string
 {
     $checksum = self::checksumData($input, $secretKey->derivePublicKey(), true);
     return AsymmetricCrypto::sign($checksum, $secretKey, $raw_binary);
 }
Пример #4
0
 /**
  * Set up our key pair
  *
  * @param SignatureSecretKey $secret
  */
 protected function setupKeyPair(SignatureSecretKey $secret)
 {
     $this->secretKey = $secret;
     $this->publicKey = $this->secretKey->derivePublicKey();
 }
Пример #5
0
 /**
  * Sign the contents of a file
  *
  * @param ReadOnlyFile $input
  * @param SignatureSecretKey $secretKey
  * @param mixed $encoding Which encoding scheme to use for the signature?
  * @return string
  */
 protected static function signData(ReadOnlyFile $input, SignatureSecretKey $secretKey, $encoding = Halite::ENCODE_BASE64URLSAFE) : string
 {
     $checksum = self::checksumData($input, $secretKey->derivePublicKey(), true);
     return AsymmetricCrypto::sign($checksum, $secretKey, $encoding);
 }