docs: def sign(self, digest, **kwargs):
          """
          Signs given digest and retirns signature
          Keyword arguments allows to set various algorithm-specific
          parameters. See pkeyutl(1) manual.
          """
          ctx = libcrypto.EVP_PKEY_CTX_new(self.key, None)
          if ctx is None:
              raise PKeyError("Initailizing sign context")
          if libcrypto.EVP_PKEY_sign_init(ctx) < 1:
              raise PKeyError("sign_init")
          self._configure_context(ctx, kwargs)
          # Find out signature size
          siglen = c_long(0)
          if libcrypto.EVP_PKEY_sign(ctx, None, byref(siglen), digest,
                                     len(digest)) < 1:
              raise PKeyError("computing signature length")
          sig = create_string_buffer(siglen.value)
          if libcrypto.EVP_PKEY_sign(ctx, sig, byref(siglen), digest,
                                     len(digest)) < 1:
              raise PKeyError("signing")
          libcrypto.EVP_PKEY_CTX_free(ctx)
          return sig.raw[:int(siglen.value)]