EldoS | Feel safer!

Software components for data protection, secure storage and transfer

XML encryption sample problem

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#8686
Posted: 01/21/2009 08:20:06
by ivan bolcina (Basic support level)
Joined: 01/21/2009
Posts: 3

Hi.

I tried to run XML encryption sample. However, I am not able to set key file needed for encryption.

So I tried to generate symmetric key by hand and save it to file, but it is invalid.
Here is my code:

Code
  
    Dim material As New TElSymmetricKeyMaterial(Nothing)
    material.Algorithm = SBConstants.Unit.SB_ALGORITHM_CNT_AES128
    material.Generate(16 * 8)
    'val = material.Valid ' --- material.valid is false
    'later on, file is not usable as a key

    Dim fs As New FileStream("C:\temp\key2.txt", FileMode.Create)
    material.Save(fs)
    fs.Flush()
    fs.Close()



I always get "invalid key material.

Also, I would greatly appriciate a sample/tutorial how to encrypt, sign and timestamp some xml.

#8687
Posted: 01/21/2009 08:34:42
by ivan bolcina (Basic support level)
Joined: 01/21/2009
Posts: 3

Also this, please...

Finally I would like to be able to encrypt xml using x509 certificate.

Any pointers about this?
#8688
Posted: 01/21/2009 10:26:26
by Dmytro Bogatskyy (EldoS Corp.)

Quote
I always get "invalid key material.

Do you get this error on Key.Load or Encryptor.Encrypt method call?
Did you set "Encryption method" as AES in "Option" form?

Quote
Also, I would greatly appriciate a sample/tutorial how to encrypt, sign and timestamp some xml.

Did you tried XMLBlackbox\Signer sample too?
For timestamping xml document you'll need to use XAdES, this option is available at signature option form.

Quote
Finally I would like to be able to encrypt xml using x509 certificate.

The Encryptor sample can encrypt xml using x509 certificate. In the sample you need to enable "Encrypt Key" option and select "Key Transport" method and for "Key File" select a certificate.
#8689
Posted: 01/21/2009 13:19:03
by Eugene Mayevski (EldoS Corp.)

Also remember to check the How-to section in documentation (Help file).


Sincerely yours
Eugene Mayevski
#8690
Posted: 01/22/2009 01:11:32
by ivan bolcina (Basic support level)
Joined: 01/21/2009
Posts: 3

Thanks.

When I invoke
Code
  
'val = material.Valid ' --- material.valid is false
'later on, file is not usable as a key

I see that material is not valid.

Then I save anyway this material to a file.

If I try to use that key file in encryption, then I get "Invalid key material" on load method.

I am also looking for some tutorial/book that would explain xml signing/encrypting/timestampting. Any suggestions.

Thank you very much for answers.
#8691
Posted: 01/22/2009 12:52:19
by Dmytro Bogatskyy (EldoS Corp.)

Quote
'val = material.Valid ' --- material.valid is false
I see that material is not valid.

Sorry, this property wasn't implemented for TElSymmetricKeyMaterial, it only applies to descendants of TElPublicKeyMaterial (e.g. TElRSAKeyMaterial, TElRSAKeyMaterial).
Quote
If I try to use that key file in encryption, then I get "Invalid key material" on load method.

Saving the key (with code above) and then loading it works for me. What version of SecureBlackbox do you use? Please post created key here or to Helpdesk system.
Quote
I am also looking for some tutorial/book that would explain xml signing/encrypting/timestampting. Any suggestions.

http://www.eldos.com/documentation/sb...ption.html
http://www.eldos.com/documentation/sb...gning.html
RFC:
http://www.w3.org/TR/xmlenc-core/
http://www.w3.org/TR/xmldsig-core/
http://uri.etsi.org/01903/v1.3.2/
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.

Reply

Statistics

Topic viewed 2752 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!