security/nss/cmd/pk11util/scripts/hssign

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 Load aolkeypk11.dll
michael@0 2 C_Initialize NULL
michael@0 3 C_GetSlotList false NULL slotCount
michael@0 4 NewArray slotList CK_ULONG slotCount
michael@0 5 C_GetSlotList false slotList slotCount
michael@0 6 #change the following to the appropriate slot id
michael@0 7 #set slotID slotList[0]
michael@0 8 set slotID 1
michael@0 9 C_GetSlotInfo slotID slotInfo
michael@0 10 C_GetTokenInfo slotID tokenInfo
michael@0 11 C_OpenSession slotID CK_SESSION_SERIAL session
michael@0 12 #
michael@0 13 #uncomment the following line and include the correct password
michael@0 14 #for authenticated tokens
michael@0 15 #C_Login session CKU_USER 0000 4
michael@0 16 #
michael@0 17 # build the search template
michael@0 18 #
michael@0 19 #NewTemplate search CKA_CLASS
michael@0 20 #SetTemplate search 0 CKO_CERTIFICATE
michael@0 21 #NewArray certID CK_ULONG 1
michael@0 22 #C_FindObjectsInit session search 1
michael@0 23 #C_FindObjects session certID 1 count
michael@0 24 #C_FindObjectsFinal session
michael@0 25 #
michael@0 26 # now read the cert out
michael@0 27 #
michael@0 28 #NewTemplate derCert CKA_VALUE
michael@0 29 #C_GetAttributeValue session certID derCert 1
michael@0 30 #BuildTemplate derCert
michael@0 31 #C_GetAttributeValue session certID derCert 1
michael@0 32 #
michael@0 33 # Do a signature
michael@0 34 #
michael@0 35 NewTemplate search CKA_CLASS
michael@0 36 SetTemplate search 0 CKO_PRIVATE_KEY
michael@0 37 NewArray privateKey CK_ULONG 1
michael@0 38 C_FindObjectsInit session search 1
michael@0 39 C_FindObjects session privateKey 1 count
michael@0 40 C_FindObjectsFinal session
michael@0 41 # sign
michael@0 42 NewMechanism rsaParams CKM_RSA_PKCS
michael@0 43 NewArray sign data 128
michael@0 44 NewArray sdata data 20
michael@0 45 C_SignInit session rsaParams privateKey
michael@0 46 C_Sign session sdata sizeof(sdata) sign sizeof(sign)
michael@0 47 #C_Logout session
michael@0 48

mercurial