EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Asp Code Sample

Posted: 06/27/2012 11:25:46
by Vsevolod Ievgiienko (Team)


Sorry, but samples for ASP are not available for now.
Posted: 06/27/2012 11:32:09
by Duward Langford (Basic support level)
Joined: 06/27/2012
Posts: 7

I see the license above and the writer but can anyone tell me what I would change the following to?
I see this one above:
Set objPGPWriter = CreateObject("PGPBBox.ElPGPWriterX")
What do I change these to? Do I just add a 8 after box?
Set objPGPKeyring = CreateObject("PGPBBox.ElPGPKeyringX")
Set objPubKey = CreateObject("PGPBBox.ElPGPPublicKeyX")
Posted: 06/27/2012 11:37:27
by Vsevolod Ievgiienko (Team)

Yes. '8' for the 8th version and '10' for the 10th beta one.
Posted: 06/27/2012 11:37:56
by Eugene Mayevski (Team)

Yes, change PGPBBox to PGPBBox8 (or 10 if you are looking at version 10 of SecureBlackbox, which will be released in a month).

If your company has a license for older version, you can get the discount on upgrading. You are welcome to contact us via HelpDesk for talking about this.

Sincerely yours
Eugene Mayevski
Posted: 06/27/2012 11:43:43
by Duward Langford (Basic support level)
Joined: 06/27/2012
Posts: 7

Thanks for the quick responses, I will go see if I can get the demo dlls to work.

Nobody can find the license for the old version either in our company or the client but the client has authorized us to purchase the new one if I can get the demo code to work.
Posted: 06/27/2012 19:29:06
by Duward Langford (Basic support level)
Joined: 06/27/2012
Posts: 7

Below is the basic code I am using to encrypt the file but the old code on the client didn't have read capabilities and I need to decrypt also can you tell me what I need to change to do a read instead of write?
Public Function ProtectSource(strSrce, strDest) As Boolean
    Dim Sign As Boolean
    Dim i As Integer
    Dim PubKey As IElPGPPublicKeyX
    Dim SecKey As IElPGPSecretKeyX
    Dim ConvEncryption As Boolean
    Dim objLicenseManager As Object
    Dim objPGPWriter As Object
    Dim objPGPKeyring As Object
    Dim objPubKey As Object
    Dim strPubKey As String
    Dim strSecKey As String
    On Error GoTo HandleErr

    'WARNING: PGPBBox application unlock, DO NOT REMOVE!!!
    Set objLicenseManager = CreateObject("PGPBBox.ElPGPLicenseManagerX")
    objLicenseManager.SetLicenseKey ("8343...1648")
    'create supporting objects
    Set objPGPWriter = CreateObject("PGPBBox8.ElPGPWriterX")
    Set objPGPKeyring = CreateObject("PGPBBox8.ElPGPKeyringX")
    Set objPubKey = CreateObject("PGPBBox8.ElPGPPublicKeyX")
    strPubKey = Session("strPubKey ")
    objPubKey.LoadFromFile (strPubKey)
    objPGPKeyring.AddPublicKey objPubKey
    objPGPWriter.EncryptingKeys = objPGPKeyring
    objPGPWriter.UseNewFeatures = True
    objPGPWriter.UseOldPackets = False
    objPGPWriter.Armor = True
    objPGPWriter.ArmorHeaders = "Version: EldoS PGPBlackbox (ActiveX edition)"
    objPGPWriter.ArmorBoundary = "PGP MESSAGE"
    objPGPWriter.Compress = True
    objPGPWriter.FileName = strSrce
    objPGPWriter.Timestamp = Now

    objPGPWriter.Protection = ptHigh

    objPGPWriter.SymmetricKeyAlgorithm = SB_PGP_ALGORITHM_SK_CAST5
    objPGPWriter.EncryptFile strSrce, strDest
    ProtectSource = True
End Function
Posted: 06/28/2012 00:24:38
by Vsevolod Ievgiienko (Team)

As you have ActiveX edition installed you can use \EldoS\SecureBlackbox.AX\Samples\VB6\SBB10\OpenPGPBlackbox\PGPFiles\Reader sample as a reference.
Posted: 06/28/2012 16:22:42
by Duward Langford (Basic support level)
Joined: 06/27/2012
Posts: 7

That is easier said then done to convert the VB code to asp requirements.
My code below is what I have figure out how to do from going through the reader but I can't get any of the passphrase commands to work and I haven't figure out how to specify the algorithm.
I keep getting onject not supported when trying the passphrase commands.
When I do the DecryptAndVerifyFile it gives me the following error.
No appropriate OpenPGP secret key for decryption found
    'WARNING: PGPBBox application unlock, DO NOT REMOVE!!!
    Set objLicenseManager = CreateObject("BaseBBox8.ElSBLicenseManagerX")
    objLicenseManager.SetLicenseKey ("8343...1648")
    'create supporting objects
    Set objPGPReader = CreateObject("PGPBBox8.ElPGPReaderX")
    Set objPGPKeyring = CreateObject("PGPBBox8.ElPGPKeyringX")
    Set objPubKey = CreateObject("PGPBBox8.ElPGPPublicKeyX")
    'load keyring from both public and secret key files
    objPGPKeyring.LoadFromFiles strPubKey, strSecKey, True
    'Set file to decrypt to
    objPGPReader.OutputFile = txtFileName
    'Decrypt the file
    objPGPReader.DecryptingKeys = objPGPKeyring
    objPGPReader.VerifyingKeys = objPGPKeyring
    'Tried all 3 and they all say objec does not support this property
    'objPGPReader.OnPassphrase txtPassword, True
    'objPGPReader.Passphrase txtPassword
    'objPGPReader.OnKeyPassphrase txtPassword

    objPGPReader.DecryptAndVerifyFile txtFileNameEncrypted
Posted: 06/29/2012 01:20:43
by Vsevolod Ievgiienko (Team)

Try to set a key password using this code

objPGPReader.KeyPassphrase = "password"
Posted: 06/29/2012 01:50:10
by Eugene Mayevski (Team)

On* are events, not properties, so event handlers must be attached properly. AddHandler does the job in VB but I am not sure about ASP in particular, and google gives tons of ASP.NET-related results when searching for "ASP AddHandler"

Sincerely yours
Eugene Mayevski



Topic viewed 6175 times

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


Back to top

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

Got it!