PIN Block translation on thales HSM not working - translation

I have encrypted a PIN block under a TPK (clear)
When I am going to translation my PIN block from encryption under TPK to encryption under ZPK given from client on real HSM then it is giving me either error code 24 or 20.
What can i do to resolve my issue ? I have tried many ways but it is not getting resolved.
Translation command I am using is CA - Translate a PIN from TPK to ZPK/BDK (3-DES DUKPT) Encryption.
Al these my operations working beautifully with thales HSM simulator.

Errors you are getting are:
Error 20:PIN block does not contain valid values
Error 24:PIN is fewer than 4 or more than 12 digits in length
You said that you have clear TPK, but you can't do anything with clear keys on HSM. You have to import key and get key under LMK for any command.
You also have to import this key as TPK key in HSM to use CA command. You can also import it as ZPK, but than you should use CC command.

Related

When creating a sqlalchemy.engine.url.URL, how do I add the file where the SSL Certification is kept

I'm using great_expectations==0.13.4 and sqlalchemy==1.3.22 and am attempting to create the string which will provide the connection in URL format. These will be added manually to the systems, as the CLI does not allow for identification of the CERT or the Schema.
I'm using the following code to define and connect to the URL, while I had this working last night my computer rebooted before I could hit save. I believe the issue is with line "query={"ssl_ca": certificate_file}", but I cannot identify the correct keyword to allow the cert file to be listed in the URL.
Any and all help is appreciated. Thank you
import sqlalchemy
certificate_file = r'c:\Users\Dir\To\My\Certificate.crt'
sqlUrl = sqlalchemy.engine.url.URL(
drivername='presto',
username=actual_user,
password= quote_plus(actual_pswd),
host= hostname,
port=port_num,
database=db_name,
query={"ssl_ca": certificate_file}
)
engine = sqlalchemy.create_engine(sqlUrl)
with engine.connect() as connection:
result = connection.execute("show schemas")
The error I get is during the line above ("with engine.connect() as connecton") is
StatementError: (builtins.TypeError) __init__() got an unexpected keyword argument 'ssl_ca'
[SQL: show schemas]
I have tried options in the URL connection for query (request_kwargs, verify & ca, ssl_ca) and some variations there in. So far no luck

couldn't get interactive broker historical data

I am working on IB Gateway and want to get the historical data.
As i have completed the steps on IB Gateway software to enable the API.
I am using python notebook for this.
For now i am running this code and i am able to import the given library but rest of the code giving me this error. Important thing is connection is established as I have mention client id 1. then it is created and can be seen on IB Gateway application.
My code is here.
from ib_insync import *
#util.startLoop() # uncomment this line when in a notebook
ib = IB()
ib.connect('127.0.0.1', 5021, clientId=1)
bars = ib.reqHistoricalData(
contract=Stock('TSLA', 'SMART', 'USD'),
endDateTime='',
durationStr='30 D',
barSizeSetting='1 hour',
whatToShow='TRADES',
useRTH=True)
print(bars)
Here is the error.
Peer closed connection
clientId 1 already in use?
API connection failed: CancelledError()
As i am using notebook if i uncomment the second line (util.startLoop()) it adds one more error about timeout..
Need help to get this done.
Big Thanks
Assign a different clientID to this connecion:
ib.connect('127.0.0.1', 5021, clientId=2)
Apparently you already have another connection with clientId=1.

How can I use sha256 in stead of sha1 as Signature Algorithm? phpsecllib

On the samples page: http://phpseclib.sourceforge.net/x509/guide.html there is a sample "Example: CA-signed cert" I have been playing with it, but whatever I do, I only get sha1 signatures. I tried to setHash('sha256'), but no luck. How can this sample code generate sha256 signatures?
Thanks!
$x509->sign($issuer, $subject, 'sha256WithRSAEncryption');
The $issuer private key needs to be an instance of RSA for that to work but that's how you'd do it.
It probably ignores the setHash('sha256') thing because (1) not all the hashes you can use with RSA have OIDs that X509.php knows about and (2) options available in RSA - like PSS signatures - aren't supported by X509.php and may not have OIDs defined by any IETF RFC and may not be supported by another other X509 implementation out there.

LabVIEW and Keithley 2635A - Unable to read data

I'm using LabVIEW and its VISA capabilities to control a Keithley 2635A source meter. Whenever I try to identify the device, it works just fine, both in reading and writing.
viWRITE(*IDN?) /* VISA subVI to send the command to the machine */
viREAD /* VISA subVI to read output */
However, as soon as I set the voltage (or current), it does so. Then I send the command to perform a measurement, but I'm not able to read that data, with the error
VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.
After that, I can not read the *IDN? output either anymore.
The source meter is connected to the PC via a National Instrument GPIB-USB-HS adaptor.
EDIT: I forgot to add, this happens in the VISA Interactive Control program as well.
Ok, apparently the documentation is not very clear. What the smua.measure.X() (where X is the needed parameter) command does is, of course, writing the measurement outcome on a buffer. In order to read that buffer, however, the simple viREAD[] is not sufficient.
So basically the answer was to simply add a print command: this way I have
viWRITE[print(smua.measure.X())];
viREAD[]
And I don't have the error anymore. Not sure why such a command is needed, but that's that. Thank you all for your time answering me.
As #Tom Blodget mentions in the comments, the machine may not have any response to read after you set the voltage. The *IDN? string is both command and query. That is, you will write the command *IDN? and read the result. Some commands do not have any response to read. Here's a quick test to see if you should be reading from the instrument. The following code is in python; I made up the GPIB command to set voltage.
sm = SourceMonitor()
# Prints out IDN
sm.query('*IDN?')
# Prints out current voltage (change this to your actual command)
sm.query('SOUR:VOLT?')
# Set a new voltage
sm.write('SOUR:VOLT 1V')
# Read the new voltage
sm.query('SOUR:VOLT?')
Note that question-marked GPIB commands and the query are used when you expect to get a response from the instrument. The instrument won't give a response for the write command. Query is a combination of write(...) and read(...). If you're using LabView, you may have to write the write and read separately.
If you need verification that the machine received your instruction and acted on it, most instruments have the following common commands:
*OPC? query to see if the operation is complete
SYST:ERR? query to see if any error was generated
Add a question mark ? to the end of the GPIB command used to set the voltage

050 + at the beginning of verified signature

I am using OpenSSL in iOS app to sign a message. I use RSA_sign to sign. When I use RSA_verify to verify the signature, result is like this
050 +(f2d7846a5f495a743e470663facf7a2858d052cf
Where f2d7846a5f495a743e470663facf7a2858d052cf is the original signature. So I am getting additional 050 +( at the beginning of the signature. Can anyone please tell me the reason of this?
This is how I am signing
int sign = RSA_sign(NID_sha1,( char *)reply, strlen(reply), signature, &siglen, myRSA );
where reply contains sha1 hashed data to be signed.
Best Regards
I'm very surprised that you see anything other than the original signature in the buffer. RSA_verify is not supposed to "return" anything other than the result of the verification (in the returned integer value, 0 for failure, 1 for success. Please use the methods as defined in the SSL documentation.
In my opinion it is a bug that you can see the hash in the first place. Unfortunately OpenSSL is not very well documented.

Resources