[Bulk] Re: [Bulk] [xmlsec] Re: Loaded Private Key and mscrypto

Edward Shallow ed.shallow at rogers.com
Thu Jan 19 15:35:43 PST 2006


Hi Aleksey,

Confirmed that problem in xmlSecSimpleKeysStoreSave is indeed with mscrypto.
Openssl works fine. Python ctypes works fine using all of c_uint(1) for
Public, c_uint(2) for Private, c_uint(4) for Symmetric, and sums thereof.
Only selected key types saved in each case. c_uint(65535) produces equiv of
0x'FFFF' and selects all types. No problem here either.

Private Exponent comes out as would be expected for both test-rsa and p12
loaded key named 'Ed Shallow' using openssl. NOT for mscrypto.

savedKeysStore.xml for both openssl and mscrypto are attached.

    keysMngr = xmlsec.xmlSecKeysMngrCreate()
    rc = xmlsec.xmlSecCryptoAppDefaultKeysMngrInit(keysMngr)
    id = xmlsec.xmlSecSimpleKeysStoreGetKlass()
    keyStore = xmlsec.xmlSecKeyStoreCreate(id)
    rc = xmlsec.xmlSecSimpleKeysStoreLoad(keyStore,
'c:/xmlsec/keys/keys.xml', keysMngr)
    desKlass = xmlsec.xmlSecKeyDataDesGetKlass()
    symmetricKey = xmlsec.xmlSecKeyGenerateByName(desKlass.contents.name,
c_uint(192), c_uint(12))
    rc = xmlsec.xmlSecKeySetName(symmetricKey, 'symmetric-des')
    rc = xmlsec.xmlSecSimpleKeysStoreAdoptKey(keyStore, symmetricKey)
    privateKey = xmlsec.xmlSecCryptoAppKeyLoad(p12, c_uint(6), password,
None, None)
    print 'xmlSecKeySetName\t\t\tstatus code',
xmlsec.xmlSecKeySetName(privateKey, 'Ed Shallow')
    rc = xmlsec.xmlSecSimpleKeysStoreAdoptKey(keyStore, privateKey)
    rc = xmlsec.xmlSecKeysMngrAdoptKeysStore(keysMngr, keyStore)
    print 'KeysMngrAdoptKeysStore \t\t\tstatus code', rc
    rc = xmlsec.xmlSecSimpleKeysStoreSave(keyStore,
'c:/xmlsec/keys/savedKeysStore65535.xml', c_uint(65535))

Ed 

-----Original Message-----
From: xmlsec-bounces at aleksey.com [mailto:xmlsec-bounces at aleksey.com] On
Behalf Of Aleksey Sanin
Sent: January 17, 2006 11:48 AM
To: ed.shallow at rogers.com
Cc: xmlsec at aleksey.com
Subject: [Bulk] Re: [Bulk] [xmlsec] Re: Loaded Private Key and mscrypto

>     rc = xmlsec.xmlSecSimpleKeysStoreSave(keyStore,
> 'c:/xmlsec/keys/savedKeysStore.xml', c_uint(65535))
>     print 'xmlSecSimpleKeysStoreSave \t\tstatus code', rc

c_uint(65535) is incorrect. Please set just private keys to be saved
(xmlSecKeyDataTypePrivate define).

Aleksey
_______________________________________________
xmlsec mailing list
xmlsec at aleksey.com
http://www.aleksey.com/mailman/listinfo/xmlsec





More information about the xmlsec mailing list