EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Signatue Mode - Text or Binary

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
Posted: 12/16/2010 18:19:38
by Shane Fulton (Basic support level)
Joined: 12/16/2010
Posts: 2


I'm just doing some testing with Secure Black Box, and Im using the EncryptAndSign method to encrypt a file. Im just wondering if this method uses Binary-mode for signatures by default. I have ascii Armor set to False, so the resulting file is in Binary-Mode - but Im not sure if this applies to the signature also.

Posted: 12/16/2010 22:09:28
by Eugene Mayevski (EldoS Corp.)

Assuming that you are asking about OpenPGP, default mode for everything is binary. Text mode is not common in cryptography world.

Sincerely yours
Eugene Mayevski
Posted: 12/16/2010 23:51:58
by Shane Fulton (Basic support level)
Joined: 12/16/2010
Posts: 2

Thanks for the reply. I think what Im doing in BlackBox is correct then.

In order to sign and encrypt the file, Im using this code (shortened a bit for convenience):

' Load key files into the keyring

keyring.Load(publicKeyFile, privateKeyFile, True)
pgpWriter.Armor = False
pgpWriter.Compress = False

' Find the public key to use from the keyring

' Get the secret key to use from the keyring

' Set properties of the PGP writer
With pgpWriter
    .EncryptingKeys = pubKeyring
    .SigningKeys = secKeyring
    .EncryptionType = SBPGP.TSBPGPEncryptionType.etPublicKey
    .Filename = f
    .InputIsText = True
    .Protection = SBPGPConstants.TSBPGPProtectionType.ptNormal
    .SignBufferingMethod = SBPGP.TSBPGPSignBufferingMethod.sbmRewind
    .SymmetricKeyAlgorithm = SBPGPConstants.Unit.SB_PGP_ALGORITHM_SK_3DES
    .Timestamp = DateTime.Now
    .UseNewFeatures = False
    .UseOldPackets = False
End With

' Create PGP output file
Dim inF, outF As System.IO.FileStream
inF = New System.IO.FileStream(f, FileMode.Open)
outF = New System.IO.FileStream(f & ".pgp", FileMode.Create)
PGPPublicKeyPassphrase = passphrase
pgpWriter.EncryptAndSign(inF, outF, 0)

The person trying to decrypt this file is telling me that the file is in binary mode, but the signature is still in text-mode instead of binary mode - this sounds incorrect to me based on what Im doing above. They are using GnuPG to decrypt, not sure if that makes a difference or not.

Posted: 12/17/2010 00:23:25
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Hi. It seems that's about .InputIsText = true, set it to false.
Posted: 12/17/2010 00:45:18
by Vsevolod Ievgiienko (EldoS Corp.)


Try to set .UseNewFeatures = True
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.



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