EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Having trouble with SecureBlackBox on a windows service.

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#12691
Posted: 03/03/2010 15:22:35
by J Choe (Basic support level)
Joined: 03/03/2010
Posts: 3

I have the following public key:

Code
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.9 (MingW32) - GPGshell v3.72

mQGiBEuOiEcRBADBhN8tGTXi2oAjM7Hj8T7lj0kj06c5xHT6VVTm+dO1h7ZA8lJl
57EscwgKNJnasctYNxGG8mPo5vmZfblCdcTeuCL8E5sRKDnFi+du7TgnZRHR7gd/
V6XT5MetNVB/z5lWFTQ/x0f1RBYWQcPAPsuMsa2aaDK8cdJRVfm9JW99gwCgqB5I
b3rTCBD6R0gm/FqP+ymzCpkD+wby6NhoQe3InmO/bhdOf+LyWwBmfofvODipXXKY
06qQ7oU6PyrUAfaWt519LlBPC8lZ5vVfBCHtFeVrV6+p74JOWC4P/vhNMJkqbZRS
pFh8wZCqlw2hUz3IrW+i4/+7tszrFz5xkGt/cwS6xWNPJbb3ds1VDAPofjTJ5TSJ
q3a3A/4ihT85r/S6YZ+URg4w0l7PuhNLgt62jr81q6LXpWLa89ElNwkXJ12juuds
YJVNlxXthMvPAlKzuKAifqmMH4lqZQraAhLZ8m1I65kMnw0sn6sSbmR3EOJ0Cywi
GVqewUPosvDC4/GNQWVC1EnxAGQrcvoPXKDQhAWzxBMC7Oc02bRKSnVzdCBFbmVy
Z3kgQ29ycC4gKEp1c3QgRW5lcmd5IENvcnAuIChEUEkpKSA8YWRtaW5pc3RyYXRv
ckBqdXN0ZW5lcmd5LmNvbT6IZgQTEQIAJgUCS46IRwIbIwUJCWa3iQYLCQgHAwIE
FQIIAwQWAgMBAh4BAheAAAoJEHel4hwQgDuzNSkAoJ+4YZ9hAznz2rkzIhWSe1DT
9CJAAKChDOZ707xv8LGag99jHeBPvMuJfbkCDQRLjohHEAgA6xSARKoKPFgYCbXg
9jSMn4qNg7qFxQlDrswKS3qFiHc+7KyoS0RpNrjKhBBSA7uCX9vYRIE3xGnsALQj
iJLrSltKclGHMAyDapKME/F6uYNzRZTwZEHR76I3YfXk2i4UXWsb1tgWa9YXe9d8
WlG+S/js0NEM+GMCyyeZ4i74Nt8M7VkJ8TbMHpVtDIIg0DZlw15dlKvl7j0l8NHl
7aq1UN9Gx20RJSIGyrRdbhjXMsD+BScfMhgdGfIGbn9/4XtwBcg74qBeQPMOAXtU
GC2ab3qDJ0X7l4rz8UhyOiapXSp5Ah4IuTn/1ZA3KJ4gFgBpUjR2dwYl6qKhjlcn
2RteuwADBgf+KjnEnceUu7ouXACC55LUqtbYlA3KP5lcNHC8iS7n6Zap11rHtJrE
jQcq6csi5/zFcrWUh/She7cGjRlZ/gSxmIJV9A7mhdZB6mHf3N55E9mn9g2GTOF2
A1G7f8phhtqQuJXXRh2ejt5trm0ldrnU1cnYuR4ZXKWmy39AGdN5yveGpQS9oyM1
54rxEwSylcXPjvSgh6svt/Zpbg75yXbntggAyvms+KzwhOWiurtrCPBBCvD8tBbG
ZzTL2tJo+YEQKDym/2NEBUMgSD55+OKeJCn3lbTvEVnIxLH8DpV/WaWhdxhNyHLU
oIQXppB+4hnODCnBdxJArYz7AFBBcuZolIhPBBgRAgAPBQJLjohHAhsMBQkJZreJ
AAoJEHel4hwQgDuzboEAnRqhUGkw3mPMFnZFyd7FiXxU6zoqAJ4qtAmU4l3FERWd
KLqypYuOtud19A==
=MEqH
-----END PGP PUBLIC KEY BLOCK-----


I have the libraries SecureBlackbox.dll and SecureBlackbox.PGP.dll referenced in my project. They are versions 6.1.0.150.

I run the following code in my windows service:

Code
SBUtils.Unit.SetLicenseKey(_license);

SBPGPKeys.TElPGPPublicKey _publicKey = new SBPGPKeys.TElPGPPublicKey();
_publicKey.LoadFromFile(_filename);


I get the following error, when trying to execute the last line of the above code:

Code
SBPGPExceptions.EElPGPInvalidPGPKeyringPacketSequence: Invalid keyring packet sequence
   at SBPGPKeys.TElPGPKeyring.OnPacket(Object Sender, Byte PacketType, TElPGPEntity& Entity, Boolean& Stop)
   at SBPGPEntities.TElPGPStreamProcessor.CreateEntity(Int32 PacketType, Boolean& Stop)
   at SBPGPEntities.TElPGPStreamProcessor.Process(Object AReadUserData, Object AWriteUserData)
   at SBPGPKeys.TElPGPKeyring.Load()
   at SBPGPKeys.TElPGPKeyring.Load(Stream APublic, Stream ASecret, Boolean Clear)
   at SBPGPKeys.TElPGPPublicKey.LoadFromStream(Stream Stream)
   at PGPEncryptService.Service1.OnStart(String[] args)


I do not get this error when I run the above code from a console application. Only when I run it from a Windows Service application.

Even more interesting, when I use the following public key, the Windows Service application does NOT throw an error, but runs perfectly:

Code
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGP 8.0.3 - not licensed for commercial use: www.pgp.com

mQGiBD/Cg/YRBADnSAOz8B8gwiwO2GSVk3XOk7grVfS0REnSeuuGWADklWr6gp+n
bCNyM1NMy9FSGIRcSp2JI+SFL3GspWysYArRNChWfVaRsz/0x8TZIZy+X43X2GFi
P1ZvCll2Fr9qQshj10DamGkxr1yNK9BsNaXoVnm6CT94K6MQN1eDeuPtdwCg//dP
MYLLsWGCiAmnXW62ekWaG5EEAJK9TorWyPZ871KLkJHB68xX5qDa9Z0XxE4wE6TQ
YrzmZUZ8FMgWr+Drx+1CY15KH3zLFZ2XNAyEdvmtlcDP7K9CPW+iSFDFzQTdiKYP
clXFIzH4NkVZSSAKteWhnk/QrshfIRURGUgslY7yGBUiB6/LaDOtJdTKRvPfpHfz
S487A/4wyOHANj/rEkrEU6FEVOE09RJTxMUNo0+Y96vDqbVjjGqltZ/KL+CwgR7Q
R1Z9PvWxNrCV5DxFr04FPF9QnP5xzRh/nhziCzyXDaBQtlebaSWPHymJqivF2PkS
vxQaky3LIqk9sNT351wZTri6lkXuc8NryfvgmE0i3X00ef4Y5LQgTGlmZUd1YXJk
IDxyd2lsbGlhbXNAbGV0aW5jLmNvbT6JAFgEEBECABgFAj/Cg/YICwMJCAcCAQoC
GQEFGwMAAAAACgkQLoHaHdFrqCoWRACfTMKXCnWSWlabTzl/6g8zJ0suSLAAnRKC
JhqWRwbjQ+EWdPrBoMRuyTSuuQINBD/Cg/YQCAD2Qle3CH8IF3KiutapQvMF6PlT
ETlPtvFuuUs4INoBp1ajFOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZ
X9x2Uk89PY3bzpnhV5JZzf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56N
oKVyOtQa8L9GAFgr5fSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kj
wEPwpVsYjY67VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obE
AxnIByl6ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAIC
CADk03AgaM3/EDqNJgkEBRYpf3sEtia6nJkOasUQHz6eagSBm9gTvx++dpUhze1B
boF6BH+FJq6aoJL7Zl42Vki5giH2BhJTtvzTmCQbpMYZbWvNIwxCDQyP1BvDZOHw
l+ap+m2SfpeQ2e3I83JIq6cCOASM6hXQ/Lo6T0uIdKFxVURtWuHq72DJS1kwzTE/
/ZuB0ZucrbQ8kF6QW5HKSolmUYGsN0mz3PBBrU/O3jyCUC30IzNnB89rPH2gTfPn
xBs6L+jZhsMYkCLQ4kEVqGF2A5W6J2kh4I2yc2rVug/frcDpPQ3GlJQpYvx+JCfQ
tfPFGJQ4B1xNSrWdbqWgsN7NiQBMBBgRAgAMBQI/woP2BRsMAAAAAAoJEC6B2h3R
a6gqNSsAn3cw3JrTec4wlZqMol600OtcspwNAJ9tXaH/4JuDI6iWKcFNnoecTtCB
dw==
=Jg/v
-----END PGP PUBLIC KEY BLOCK-----


Can you think of any reasons this might be the case?
#12692
Posted: 03/03/2010 15:26:10
by Ken Ivanov (EldoS Corp.)

Thank you for contacting us.

Please do not use TElPGPPublicKey.LoadFromStream() method directly. Use TElPGPKeyring.Load() method instead and then get the key object via its get_PublicKeys() method.
#12693
Posted: 03/03/2010 15:36:37
by J Choe (Basic support level)
Joined: 03/03/2010
Posts: 3

I run the following code in the Windows Service application:

Code
SBPGPKeys.TElPGPKeyring _keyring = new SBPGPKeys.TElPGPKeyring();

_keyring.Load(_filename, string.Empty, true);

SBPGPKeys.TElPGPPublicKey _publickey = _keyring.get_PublicKeys(0);


The program throws an error on the line _keyring.Load(...):

Code
SBPGPExceptions.EElPGPInvalidPGPKeyringPacketSequence: Invalid keyring packet sequence
   at SBPGPKeys.TElPGPKeyring.OnPacket(Object Sender, Byte PacketType, TElPGPEntity& Entity, Boolean& Stop)
   at SBPGPEntities.TElPGPStreamProcessor.CreateEntity(Int32 PacketType, Boolean& Stop)
   at SBPGPEntities.TElPGPStreamProcessor.Process(Object AReadUserData, Object AWriteUserData)
   at SBPGPKeys.TElPGPKeyring.Load()
   at SBPGPKeys.TElPGPKeyring.Load(Stream APublic, Stream ASecret, Boolean Clear)
   at SBPGPKeys.TElPGPKeyring.Load(String PublicKeysFile, String SecretKeysFile, Boolean Clear)
   at PGPEncryptService.Service1.OnStart(String[] args)
#12697
Posted: 03/03/2010 16:36:30
by Ken Ivanov (EldoS Corp.)

OpenPGPBlackbox code itself does not have any dependencies that can make it not work under Windows service. I tend to consider that the issue is somehow related to access rights. Can you please try to execute the attached code from your service application and check if it exposes the same issue?


[ Download ]
#12700
Posted: 03/03/2010 17:22:40
by J Choe (Basic support level)
Joined: 03/03/2010
Posts: 3

That worked. Thanks very much!
#12705
Posted: 03/04/2010 02:26:36
by Ken Ivanov (EldoS Corp.)

This confirms my assumption about access rights. It is possible that the file is inaccessible to the service for some reason.
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

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