75147

PKCS1_PSS sign() method

Question:

I have been trying to fix an issue but failed countless times. I need to use a method, sign(), and I have the correct library imported, however its still not being recognized.

I'm coding in Python and this is what I have that seems important:

#importing the library from Crypto.Signature import PKCS1_PSS [...] signer = PKCS1_PSS.new(keypair) sig = PKCS1_PSS.sign(keypair)

But the sign() method is the only thing in the entire code from that library that doesn't get recognized:

<blockquote>

"This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items."

</blockquote>

Does anyone have any suggestions on how to fix this or know what I'm doing wrong?

Answer1:

The documentation of <a href="https://www.dlitz.net/software/pycrypto/api/current/Crypto.Signature.PKCS1_PSS-module.html" rel="nofollow">PKCS1_PSS</a> is wrong. It currently says:

from Crypto.Signature import PKCS1_PSS from Crypto.Hash import SHA from Crypto.PublicKey import RSA from Crypto import Random message = 'To be signed' key = RSA.importKey(open('privkey.der').read()) h = SHA.new() h.update(message) signer = PKCS1_PSS.new(key) signature = PKCS1_PSS.sign(key)

But it should be the following analogous to the documentation of <a href="https://www.dlitz.net/software/pycrypto/api/current/Crypto.Signature.PKCS1_v1_5-module.html" rel="nofollow">PKCS1_v1_5</a>

from Crypto.Signature import PKCS1_PSS from Crypto.Hash import SHA from Crypto.PublicKey import RSA from Crypto import Random message = 'To be signed' key = RSA.importKey(open('privkey.der').read()) h = SHA.new() h.update(message) signer = PKCS1_PSS.new(key) signature = signer.sign(h)

Recommend

  • Getting HTTP 406 while calling external site from within servlet
  • what is python runpy module? [closed]
  • textBox embedded in a ListBox initial focus
  • Selecting Unique Rows between Two DataFrames in Pandas
  • generating all unique pairs from a list of numbers, n choose 2
  • How to put a value in flash when testing an action
  • What does the delayed() function do (when used with joblib in Python)
  • Android/IOS Secret expiration management with client credentials flow
  • Retrieving postback from Dynamically created controls in MVC without using FormCollection
  • SSH Connection to a remote server using PHP
  • How to change type datatable column [duplicate]
  • pip installation of gmpy2
  • How can I add EXIF information to geotag an Image in .NET?
  • Inno Setup event that is generated when folder is browsed on TInputDirWizardPage?
  • Tomcat 9 Valve Causing Server Start Failure
  • Hibernate EmptyInterceptor onFlushDirty() is not executing
  • Simulating argparse command line arguments input while debugging
  • How to customize marker colors and shapes in scatter plot?
  • Why do I need an infinite loop in STM32 programming?
  • Display standard razor/mvc 3 validation messages displayed in another language
  • Is possible having two COM STA instances of the same component?
  • Java Collections.shuffle() weird behaviour [closed]
  • How to create subsets of a single set of elements with XSLT?
  • how to run a different select statement based on condition in Hive SQL
  • Zoho API: Get the user that is making the request
  • Conflicting declaration using constexpr and auto in C++11
  • Terminal run dalvikvm with am.jar
  • Another “Cannot make static reference…” Question
  • How to handle div that is created dynamically in a table
  • Make checkout phone field optional for specific countries in WooCommerce
  • Using Service Component Runtime
  • Creating random wired topology for given arbitrary number of nodes on NS2
  • Access to a Matlab gui from the web
  • ReferenceError: TextEncoder is not defined