EasyByte Software

Welcome to EasyByte Software

Home Buy Online Products Downloads Support
ASP and dotNET
Further Information



PGPAddKeyToKeyRing Method

Cryptocx v7 User Guide


PGPAddKeyToKeyRing Method

This is the method that you use to add a key to a keyring. The key will be fed into the control in a string.



Adds a key (public or private) to a keyring


x = object.PGPAddKeyToKeyRing

The syntax of the PGPAddKeyToKeyRing method has these parts:

Part Description
object A Cryptocx v7 control.
x A string that becomes either "TRUE" or "Error: xxx" where xxx is the error message.

Remarks If for whatever reason the method fails to complete, the method will return some text stating exactly what has gone wrong. 

The only properties of the control that you need to specify are the PublicKey properties of the control and the KeyFolder where the key ring resides.

You can specify either a key as a string (example below) or a valid .asc file that contains a valid key to add to a keyring. When specifying a .asc file you just set the PublicKey property to the filename for example:

Cryptocx.PublicKey = "c:\somekey.asc"


The PGPAddKeyToKeyRing method will automatically search through the specified folder (KeyFolder property) for valid keyring files. The first valid keyring file that is found in the specified folder will be used and the key will be added to that keyring file.

If the key that you are trying to add is already in the key ring then the key will not be added to the public keyring again.



Example Sample Visual Basic Code to add a key to a keyring located in "c:\rings"

Where Cryptocx1 is an instance of a Cryptocx Control.

if x =  "TRUE" then the key was added to the keyring, if it does not equal "TRUE" then is will contain some information about why the key was not added to the key ring.

Cryptocx1.KeyFolder = "c:\rings\"
Cryptocx1.PublicKey = "-----BEGIN PGP PUBLIC KEY BLOCK-----" & vbCrLf
"Version: Cryptocx v7" & vbCrLf
"" & vbCrLf
"eXRliQBVAwUQPA1lQwHyxavJvxpFAQFg6AH/W0yw+0cIVDic3L8JcFCt47aJWJhV" & vbCrLf
"EYeP+j/jhN3QmyFz5f8qdh4ZR8FkL8NAO+mFfJgojnhdUaKpSeY85uavEA==" & vbCrLf
"=1Djd" & vbCrLf
"-----END PGP PUBLIC KEY BLOCK-----" & vbCrLf

x = Cryptocx1.PGPAddKeyToKeyRing





Back to Contents Page


Click here to set this great site as your home page

Or click here to add it to your Favorites.


Copyright (c) EasyByte Software 1998-2008, info@easybyte.com