The string quote not full,''' has syntax error - sql

I execute a update statement in SQL Server 2008:
declare #DynamicSQL nvarchar(500)
set #ecaKey='b3 ff c7 ff b9 ff 93 ff bb ff a5 ff a8 ff 86 ff 94 ff 87 ff a6 ff 9a ff 98 ff d4 ff 90 ff ad ff 8c ff 95 ff cb ff a9 ff 91 ff 9b ff 8f ff b1 ff ac ff c6 ff 92 ff 86 ff af ff b6 ff 87 ff 85 ff 91 ff 90 ff ca ff 88 ff 8b ff cc ff 9d ff b2 ff a7 ff bb ff 9c ff c8 ff cf ff 92 ff 8c ff 87 ff 8c ff bb ff ba ff 8f ff ba ff'
set #DynamicSQL='update '+#sysDBName+'..sys_ecasoftkey set softkey=N'''+#ecaKey+''' where state=''1'''
exec(#DynamicSQL)
It tips that:
Message 105,Level 15,state 1, 1 row
The string 'b3 ff c7 ff b9 ff 93 ff bb ff a5 ff a8 ff 86 ff 94 ff 87 ff a6 ff 9a ff 98 ff d4 ff 90 ff ad ff 8c ff 95 ff cb ff a9 ff 91 ff 9b ff 8f ff b1 ff ac ff c6 ff 92 ff 86 ff af ff b6 ff 87 ff 85 ff 91 ff 90 ff ca ff 88 ff 8b ff cc ff 9d ff b2 ff a7 ff bb ff 9c ff c8 ff cf ff 92 ff 8c ff 87 ff 8c ff bb ff ba ff 8f ff ba ff bc ff d4 ff 8b ff b6 ff ba ff bd ff 97 ff a6 ff 98 ff 95 ff 9d ff ab ff aa ff ba ff a5 ff cd ff 9d ff 94 ff c7 ff ba ff bc ff b0 ff 9b' don't have full quote。
Message 102,level 15,state 1, 1 row
'b3 ff c7 ff b9 ff 93 ff bb ff a5 ff a8 ff 86 ff 94 ff 87 ff a6 ff 9a ff 98 ff d4 ff 90 ff ad ff 8c ff 95 ff cb ff a9 ff 91 ff 9b ' nearby has syntax error.
The softkey and state columns is varchar.
Where is going wrong?

That's because the length of #DynamicSQL is not long enough.Change your length like this:
declare #DynamicSQL nvarchar(2000)
Although your current string(500) is long enough, but this problem is cause by this reason exactly.
When i changed the problem resolved.

Related

SPI doesn’t work on Jetson Nano 2GB. How to use SPI on Jetson Nano?

SPI doesn’t want to work on my Jetson Nano.
In my devices from terminal I have this:
val#val-desktop:~$ ls /dev/spi*
/dev/spidev0.0 /dev/spidev0.1 /dev/spidev1.0 /dev/spidev1.1
And this:
val#val-desktop:~$ lsmod | grep spi
spidev 13282 0
When I’m connecting MISO and MOSI pins(19 and 21 pins according to this picture ) and testing SPI with this code I have this:
val#val-desktop:~/spi_test$ ./spi_test -v -D /dev/spidev0.0
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 kHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |…#…|
RX | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |…|
No response. I was trying all 0.0 0.1 1.0 1.1 variants.
What am I doing wrong?

How SHA-RSA works?

Sorry for my noob question, i'm new in this field (but i'm curious).
I've found an xml file with two fields: DATA and SIGNATURE.
DATA is an Ascii text, SIGNATURE is an SHA1-RSA1024 string composed by 256 hex characters (128bytes).
I don't understand how can bi obtained that signature from the data field: the data is elaborated with the RSA and then with SHA or it is the contrary?
I'm studying RSA and i think i should find something like this:
00 01 FF FF .. FF FF 00 DigestInfo MessageDigest
But it is not true: my signature data doesn't contain that string.
Can you explain me the procedure used to obtain the signature?
Do you have a link with an example (maybe in Python, due to its simplicity)?
The security.stackexchange.com answer has pretty good detail, but here's the short form (since they don't seem to quite answer your question.
The first step is EMSA-PKCS1-v1_5, where M is the (unhashed) message and emLen is the size (in bytes) of the RSA key (which is usually expressed in bits).
H = Hash(M). We know Hash is SHA-1 (by the question), so the output is 20 bytes. Let's assume it produced 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20.
Construct T:
// DigestInfo = SEQUENCE(AlgorithmIdentifier, OCTET STRING)
30 21
// AlgorithmIdentifier = SEQUENCE(OBJECT IDENTIFIER, ANY)
30 09
// OBJECT IDENTIFIER(SHA1) => OBJECT IDENTIFIER(1.3.14.3.2.26)
06 05 2B 0E 03 02 1A
// NULL (SHA-1 has no parameters)
05 00
// OCTET STRING(H)
04 14 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
Since everything in this structure has fixed values (SHA-1 OID) and/or length (H=20 bytes) T is just (30 21 30 09 06 05 2B 0E 03 02 1A 05 00 04 14 concat H) (for SHA-1).
Let's assume we have a 2048-bit key (256 bytes). Since tLen=35, emLen > tLen + 11, so we're good to proceed.
Now, build PS. It is emLen - tLen - 3 FF. For SHA-1 with RSA-2048 that means a sequence of 218 FFs.
EM = 00 01 PS 00 T
Gluing everything together now, we get (for SHA-1 and a 2048-bit key)
00 01 FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF 00 30 21 30
09 06 05 2B 0E 03 02 1A 05 00 04 14 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
As you can see, the hash output is still visible, at the very end. The EMSA-PKCS1-v1_5 padded structure seems to be what you expected.
Then, EM gets applied through the RSA private key formula to produce the signature:
`signature` = MODPOW(`EM`, `d`, `n`)
Since the value of signature now depends on d (the private key) no fixed example can be given. But this last step is why a) it's cryptographically sound, and b) you can't find your MessageDigest value within the signature value anymore.
For RSA signatures the signature gets verified as
`candidate` = MODPOW(`signature`, `e`, `n`)
return ConstantTimeSequenceEquals(`candidate`, `EM`);
The new RSA signature algorithm (PSS (Probabilistic Signature Scheme)) works quite differently. And, it's worth noting, DSA and ECDSA work even more quite differently.

PSI/SI Pat Packet Output

I am developing PSI SI software. I am new to this technology. By reading some material, I have made some of the PSI packets and sending through UDP.
I am converting it into Hexadecimal and sending them throough UDP.
I am using wireshark and TS Reader to check whether packets are properly created. In wireshark it shows the table name in info column i.e. PAT, BAT etc.
But in TS reader nothing comes up. What I am missing? I have tried many ways but no way it comes in TSReader.
Is there any special that need to be used? Is there any other part that I need to work before sending the packets and to make them view in TS Reader?
Packet:
47 60 00 10 00 00 F0 35 00 01 e3 00 01 00 00 00 10 01 01 01 b1 01 02 01 b2 01 03 01 b3 01 04 01 b4 01 06 1f ff 01 07 01 b7 01 0a 01 ba 01 0b 01 bb 01 18 10 30 01 1a 10 31 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
Packet Output in wireshark
No Output in TSReader:

How can I update oob data in U-Boot

I'm trying to update an oob area of NAND within U-Boot using 'nand write.oob'. However, my changes aren't taking effect.
The process I'm following is:
Use 'nand read.oob' to read the oob section for my offset
Use 'md' to display that data and make sure it's what I expect
Use 'mm' to modify the data in memory to be what I want
Use 'nand write.oob' to write the modified data back to nand
Use 'nand read.oob' to read the data back from nand
Use 'md' to display what should be the modified data on nand.
Unfortunately the data that I read back from NAND appears unmodified.
Is there any way to do what I want?
The processor is a TI DM3730 and the NAND part is the MT29C2G48MAKLCJI-6 IT.
Here's the full output of what I'm doing:
Overo # nand info
Device 0: nand0, sector size 128 KiB
Page size 2048 b
OOB size 64 b
Erase size 131072 b
Overo # nandecc hw
1-bit hamming HW ECC selected
Overo # nand read.oob 0x80010000 0x20000 40
NAND read: device 0 offset 0x20000, size 0x40
64 bytes read: OK
Overo # md.b 0x80010000 40
80010000: 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
80010010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
80010020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
80010030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
Overo # mm.b 0x80010000
80010000: 00 ? ff
80010001: 00 ? ff
80010002: ff ? q
Overo # md.b 0x80010000 40
80010000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
80010010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
80010020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
80010030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
Overo # nand write.oob 0x80010000 0x20000 40
NAND write: device 0 offset 0x20000, size 0x40
64 bytes written: OK
Overo # nand read.oob 0x80010000 0x20000 40
NAND read: device 0 offset 0x20000, size 0x40
64 bytes read: OK
Overo # md.b 0x80010000 40
80010000: 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
80010010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
80010020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
80010030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
Notice that the data at 0x80010000 and 0x80010002 is not 'ff' as it should be.

MS Project 2010 - How to restore macros from (corrupt?) Global.MPT

i was developing some VBA macro during a day - 500 lines of code. Code was placed into Global.mpt because i was going to reuse it across different project files.
At some moment i missed to increment cycle in the while cycle. When debugging this brought MS Project into endless non-responsive 100%-CPU-usage loop. I had to kill MS Project from task manager and after restarting it i see no VBA modules in Global.mpt. I see names of my variables and procedures in existing Global.MPT, but there is no plain code to restore manually.
When i try renaming Global.MPT into MyGlobal.MPT and opening it, MS Project shows 'Organizer' dialog suggesting to import content from MyGlobal.MPT to Global.MPT but 'Modules' tab shows empty list of like there is nothing to import.
Is there way to fix or export VBA content from the file? I do not want to loose day of works :(
For referrence - module named MyModule with following content
Sub HelloWorld()
MsgBox 'HelloWorld'
End Sub
Looks like following in the VBA stream
0012BA04 01 16 01 00 02 F0 00 00 00 BC 02 00 00 D4 00 00 |................|
0012BA14 00 B0 01 00 00 FF FF FF FF EA 02 00 00 8A 03 00 |................|
0012BA24 00 00 00 00 00 01 00 00 00 7D 0A CF 43 00 00 FF |.........}..C...|
0012BA34 FF 03 00 00 00 00 00 00 00 B6 00 FF FF 01 01 00 |................|
0012BA44 00 00 00 FF FF FF FF 00 00 00 00 FF FF 04 00 FF |................|
0012BA54 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0012BA64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0012BA74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0012BA84 00 00 00 00 00 00 00 10 00 00 00 03 00 00 00 05 |................|
0012BA94 00 00 00 07 00 00 00 FF FF FF FF FF FF FF FF 01 |................|
0012BAA4 01 08 00 00 00 FF FF FF FF 78 00 00 00 02 00 00 |.........x......|
0012BAB4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0012BAC4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF |................|
0012BAD4 00 00 00 00 4D 45 00 00 FF FF FF FF FF FF 00 00 |....ME..........|
0012BAE4 00 00 FF FF 00 00 00 00 FF FF 01 01 00 00 00 00 |................|
0012BAF4 DF 00 FF FF 00 00 00 00 04 00 FF FF FF FF FF FF |................|
0012BB04 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
0012BB14 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
0012BB24 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
0012BB34 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
0012BB44 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
0012BB54 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
0012BB64 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
0012BB74 FF FF FF FF FF FF FF FF FF FF 28 00 00 00 00 00 |..........(.....|
0012BB84 36 0A FF FF FF FF 00 00 00 00 02 3C 08 00 FF FF |6..........<....|
0012BB94 00 00 00 00 02 3C 0C 00 FF FF 00 00 00 00 02 3C |.....<.........<|
0012BBA4 FF FF FF FF 00 00 FF FF 01 01 00 00 00 00 00 00 |................|
0012BBB4 01 00 00 00 FF FF FF FF 01 01 80 00 00 00 38 00 |..............8.|
0012BBC4 00 00 FF FF FF FF 02 83 1C 02 FF FF FF FF 08 00 |................|
0012BBD4 FF FF 30 00 00 00 00 00 FF FF FF FF FF FF 00 00 |..0.............|
0012BBE4 00 00 FF FF FF FF FF FF FF FF 00 00 00 00 1D 00 |................|
0012BBF4 00 00 25 00 00 00 0B 12 1E 02 FF FF FF FF 00 00 |..%.............|
0012BC04 00 60 00 00 00 00 FF FF FF FF FF FF FF FF 00 00 |.`..............|
0012BC14 00 00 00 00 00 00 FF FF FF FF 7C FF 00 00 FF FF |..........|.....|
0012BC24 FF FF FF FF FF FF FF FF FF FF 03 00 03 00 00 00 |................|
0012BC34 84 00 00 03 00 00 FF FF FF FF C0 01 00 00 01 00 |................|
0012BC44 01 00 00 00 00 00 00 00 00 00 00 00 00 00 38 00 |..............8.|
0012BC54 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
0012BC64 FF FF FF FF FF FF 38 00 00 00 FF FF FF FF FF FF |......8.........|
0012BC74 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
0012BC84 FF FF FF FF FF FF 08 00 00 00 00 00 00 00 01 00 |................|
0012BC94 00 00 08 00 04 00 FF FF FF FF 00 00 00 00 FF FF |................|
0012BCA4 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |................|
0012BCB4 FF FF FF FF FF FF 02 00 00 00 00 00 E4 E7 C5 4E |...............N|
0012BCC4 0E 00 01 24 00 2A 00 5C 00 52 00 66 00 66 00 66 |...$.*.\.R.f.f.f|
0012BCD4 00 66 00 2A 00 30 00 3F 00 34 00 65 00 63 00 35 |.f.*.0.?.4.e.c.5|
0012BCE4 00 65 00 37 00 65 00 39 00 DF 00 00 00 00 00 00 |.e.7.e.9........|
0012BCF4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0012BD04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0012BD14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
0012BD24 00 00 00 00 00 00 FE CA 01 00 03 00 22 81 08 00 |............"...|
0012BD34 06 00 00 00 00 00 00 00 00 81 08 04 18 00 00 00 |................|
0012BD44 10 00 00 00 04 81 08 00 02 00 00 00 08 00 00 00 |................|
0012BD54 FF FF FF FF 01 01 30 00 00 00 96 04 38 00 00 00 |......0.....8...|
0012BD64 00 00 6F 00 FF FF 70 00 00 00 41 40 22 02 00 00 |..o...p...A#"...|
0012BD74 E0 00 0B 00 0B 00 48 65 6C 6C 6F 57 6F 72 6C 64 |......HelloWorld|
0012BD84 27 00 FF FF FF FF 50 00 00 00 FF FF FF FF 00 00 |'.....P.........|
0012BD94 01 52 B0 00 41 74 74 72 69 62 75 74 00 65 20 56 |.R..Attribut.e V|
0012BDA4 42 5F 4E 61 6D 00 65 20 3D 20 22 4D 79 4D 00 6F |B_Nam.e = "MyM.o|
0012BDB4 64 75 6C 65 22 0D 0A 00 53 75 62 20 48 65 6C 6C |dule"...Sub Hell|
0012BDC4 00 6F 57 6F 72 6C 64 28 29 08 0D 0A 20 00 00 4D |.oWorld()... ..M|
0012BDD4 73 67 42 10 6F 78 20 27 07 64 27 0D 0A 10 45 6E |sgB.ox '.d'...En|
0012BDE4 64 20 00 5C 0D 0A |d .\..|
Other solutions are to recover from backup. Open on another machine with Project or repair the User Profile. It may be corrupt. If you can log in with another username to the PC and try to open the file. Good luck,
OR:
1] Go t File --> Options --> Trust Center --> click on Trust Center Settings --> Select the option "Allow loading files with legacy or non-default file formats" and try opening the file.
2] Open a blank project and try inserting the problematic file and try opening it.
The easiest way is to simply change the file extension to MPP and open it as a project. The organizer will come up and ask you if you want to copy the MPP's macros and code into your new (blank) MPT file. Just slide them over and you're good as gold (you'll have to reset your references, but otherwise, ready to go)