EldoS | Feel safer!

Software components for data protection, secure storage and transfer

About SerialNumber

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#10239
Posted: 05/31/2009 01:31:31
by Eugene Mayevski (EldoS Corp.)

Where exactly do you get this "big number format"? What software produces it?

The reason I am asking is that it can mean anything and conversion to byte[] might produce wrong result. The most obvious way is

String SN = "12345678";
byte[] serial = SN.getBytes();

But this is not always correct.


Sincerely yours
Eugene Mayevski
#10243
Posted: 05/31/2009 13:51:10
by Thanh Nguyen Trung (Priority Standard support level)
Joined: 09/12/2008
Posts: 73

Hi,

Quote
<X509IssuerSerial>
<X509IssuerName>DC=net, DC=mydomain, CN=MyCA</X509IssuerName>
<X509SerialNumber>84337837802106010992659</X509SerialNumber>
</X509IssuerSerial>


This xml tags are extracted from a xades signature generated by SBB. I think the SerialNumber above is not in hex string, Is it true? I would like to convert the string to byte[]. But I am not sure if it is ok to use your example code using the GetBytes() function.
#10244
Posted: 05/31/2009 14:07:15
by Dmytro Bogatskyy (EldoS Corp.)

Quote
I think the SerialNumber above is not in hex string, Is it true?

Yes, it is a decimal number.
Quote
I would like to convert the string to byte[]

Is a X509IssuerSerial element taken from KeyInfo element or XAdES info?
For example, TElXMLKeyInfoX509Data class have a indexed property SerialNumbers and TElXMLCertID class (for XAdES) have a property IssuerSerial.SerialNumber of type byte[]
#10245
Posted: 05/31/2009 14:32:03
by Thanh Nguyen Trung (Priority Standard support level)
Joined: 09/12/2008
Posts: 73

Hi,


Now, I can extract the XML document and Load it into the X509IssuerSerial and get the SerialNumber in byte, it is OK, thank SBB.

Is it a decial number in big number format? (i am not sure). If it is a big number, so I would like to know if there is a function or class in SBB to play with this kind of number to convert into byte[] do or something else.

Thanks for your support!
Thanh
#10247
Posted: 06/01/2009 04:18:55
by Dmytro Bogatskyy (EldoS Corp.)

Quote
Is it a decial number in big number format?

Yes, it is.
Quote
If it is a big number, so I would like to know if there is a function or class in SBB to play with this kind of number to convert into byte[] do or something else.

There is no open class/function for this.
For converting from/to big number format the ElXMLIssuerSerial.LoadFromStream and SaveToStream methods use the internal type SBMath.TLInt and functions SBMath.Unit.LCreate, LDestroy, LZero, LMult, LAdd... These functions are not documented, and could change without notice.
#10258
Posted: 06/01/2009 12:45:17
by Thanh Nguyen Trung (Priority Standard support level)
Joined: 09/12/2008
Posts: 73

Hi,

Yes, I will take a look at the SBMath. Thanks for your support!

Best
Thanh
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.

Reply

Statistics

Topic viewed 5231 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!