Code Duplication    Length = 14-16 lines in 2 locations

src/Signer/OpenSSL.php 2 locations

@@ 27-42 (lines=16) @@
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function sign($input, $key)
28
    {
29
        if ($key instanceof Keychain) {
30
            $key = $key->privateKey();
31
        }
32
33
        if (!$key instanceof PrivateKey) {
34
            $key = new PrivateKey($key);
35
        }
36
37
        $this->verifyType($key);
38
39
        openssl_sign($input, $signature, $key->get(), $this->hashingAlgorithm());
40
41
        return $signature;
42
    }
43
44
    /**
45
     * {@inheritdoc}
@@ 47-60 (lines=14) @@
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function verify($input, $signature, $key)
48
    {
49
        if ($key instanceof Keychain) {
50
            $key = $key->publicKey();
51
        }
52
53
        if (!$key instanceof PublicKey) {
54
            $key = new PublicKey($key);
55
        }
56
57
        $this->verifyType($key);
58
59
        return (bool) openssl_verify($input, $signature, $key->get(), $this->hashingAlgorithm());
60
    }
61
62
    /**
63
     * @return int