Back to the Function Reference Table of Contents

Key-Manipulation Functions


spgpKeyGenerate

Generate a public-private key-pair. This function should be considered experimental and subject to change.

Visual Basic declaration:

Declare Function spgpkeygenerate Lib "spgp.dll" (
        ByVal UserID As String, 
        ByVal PassPhrase As String, 
        ByVal NewKeyHexID As String, 
        ByVal KeyAlg As Long, 
        ByVal CipherAlg As Long, 
        ByVal Size As Long, 
        ByVal Expires As Long, 
        ByVal FastGeneration As Long, 
        ByVal FailWithoutEntropy As Long, 
        ByVal WinHandle As Long
        ) As Long

Parameters:
UserID The new key's User ID. By convention this is a name followed by an e-mail address set in angle brackets.
PassPhrase The passphrase for the new key.
NewKeyHexID A fixed-length string which will act as a buffer for output. If the function returns successfully, the buffer will contain the new key's Hex ID.
KeyAlg The new key's public-key algorithm. May be one of the following:
"1" or the constant PGPKeyAlgorithm_RSA
"5" or the constant PGPKeyAlgorithm_DSA
The RSA algorithm may not be available for key generation in all versions of PGP.
CipherAlg The new key's preferred ciphering algorithm. May be one of the following:
"1" or the constant PGPCipherAlgorithm_IDEA
"2" or the constant PGPCipherAlgorithm_3DES
"3" or the constant PGPCipherAlgorithm_CAST5
If CipherAlg is set to "0", a default algorithm based on KeyAlg will be used: IDEA for RSA keys, CAST for DSA.
Note that this only sets a preference for the new key, it can't guarantee or force the use of a certain algorithm. The actual algorithm used for ciphering will depend on the local PGP implementation.
Size Size of the new key, in bits. The minimum size is 512; the maximum for RSA keys is 2048; the maximum for DSA keys is 1024. Some versions of PGP may generate larger RSA keys.
Expires The number of days until the key expires. According to the PGP SDK documentation, "the PGPsdk adds the specified number of days to the current system time, which establishes the [key's] expiration date." 0 = no expiration.
FastGeneration May be 0 (false) or 1 (true). If true, the key will be generated in 'fast' mode, i.e., based on 'known' primes instead of dynamically generated primes.
FailWithoutEntropy Should the function fail if there aren't enough random bits? May be 0 (false) or 1 (true). If false, and insufficient random bits are available, a dialog will appear and prompt the user to provide the necessary random input. If true, the function will abort and return an error.
WinHandle Handle (i.e., Hwnd) to the calling application or window. Passing this handle to the function makes any resulting dialog-boxes "children" of the calling application. If FailWithoutEntropy is false, the handle must be provided.

Notes and Warnings:

up to the top

spgpSubKeyGenerate

Generate an encryption sub-key and attach it to an existing key-pair. This function should be considered experimental and subject to change.

Visual Basic declaration:

Declare Function spgpsubkeygenerate Lib "spgp.dll" (
        ByVal MasterKeyHexID As String, 
        ByVal MasterKeyPass As String, 
        ByVal NewSubKeyHexID As String, 
        ByVal KeyAlg As Long, 
        ByVal Size As Long, 
        ByVal ExpiresIn As Long, 
        ByVal FastGeneration As Long, 
        ByVal FailWithoutEntropy As Long, 
        ByVal WinHandle As Long
        ) As Long

Parameters:
MasterKeyHexID Hex ID of the master key, i.e., the key to which the sub-key will be Attached.
MasterKeyPass Passphrase to access the master key.
NewSubKeyHexID A fixed-length string which will act as a buffer for output. If the function returns successfully, the buffer will contain the new sub-key's Hex ID.
KeyAlg The new sub-key's public-key algorithm. As of February 2000, only ElGamal (a.k.a. Diffie-Hellman) is available for encryption sub-keys, so the value of KeyAlg must be either "1" or the constant PGPPublicKeyAlgorithm_ElGamal.
Size Size of the new sub-key, in bits. The minimum size is 512, the maximum is 4096.
Expires The number of days until the key expires. According to the PGP SDK documentation, "the PGPsdk adds the specified number of days to the current system time, which establishes the [sub-key's] expiration date." 0 = no expiration.
FastGeneration May be 0 (false) or 1 (true). If true, the key will be generated in 'fast' mode, i.e., based on 'known' primes instead of dynamically generated primes.
FailWithoutEntropy Should the function fail if there aren't enough random bits? May be 0 (false) or 1 (true). If false, and insufficient random bits are available, a dialog will appear and prompt the user to provide the necessary random input. If true, the function will abort and return an error.
WinHandle Handle (i.e., Hwnd) to the calling application or window. Passing this handle to the function makes any resulting dialog-boxes "children" of the calling application. If FailWithoutEntropy is false, the handle must be provided

Notes and Warnings:

up to the top

spgpKeySign

Sign a specific user ID on a given key.

Visual Basic declaration:

Declare Function spgpkeysign Lib "spgp.dll" (
	ByVal KeyHexID As String,
	ByVal UserID As String, 
	ByVal SignKeyID As String, 
	ByVal SignKeyPass As String, 
	ByVal Expires As Long, 
	ByVal Exportable As Long, 
	ByVal Trust As Long, 
	ByVal Validity As Long
	) As Long

Parameters:
KeyHexID The hexidecimal ID of the target key. This must be prefixed by "0x".
UserID The user ID to sign. This must be the complete user ID, i.e., name and e-mail address.
SignKeyID The signer's private key ID, which can be either the e-mail address from the key's user-ID or the ID number of the key itself, which must be prefixed by "0x".
SignKeyPass Passphrase to access signer's private key.
Expires The number of days until the signature expires. According to the PGPsdk documentation, "the PGPsdk adds the specified number of days to the current system time, which establishes the [signature's] expiration date." 0 = no expiration.
Exportable Exportable signature? May be 0 (false) or 1 (true). If false, the signature will not be included with the signed key if the key is exported.
Trust Not implemented.
Validity Not implemented.

Notes and Warnings:

up to the top

spgpKeySigRemove

Remove a signature from a key's user ID.

Visual Basic declaration:

Declare Function spgpkeysigremove Lib "spgp.dll" (
	ByVal KeyHexID As String,
	ByVal UserID As String, 
	ByVal SignHexID As String
	) As Long

Parameters:
KeyHexID The hexidecimal ID of the target key. This must be prefixed by "0x".
UserID The user ID bearing the signature. This must be a complete user ID, i.e., name and e-mail address.
SignHexID The hexidecimal key ID of the signing key, which must be prefixed by "0x".

Notes and Warnings:

up to the top

spgpKeyEnable

Enable a disabled public key on the local key-ring.

Visual Basic declaration:

Declare Function spgpkeyenable Lib "spgp.dll" (
        ByVal KeyID As String
        ) As Long

Parameters:
KeyID The key ID of the target key. This function will only enable one key at a time.

Notes and Warnings:

up to the top

spgpKeyDisable

Disable a public key on the local key-ring.

Visual Basic declaration:

Declare Function spgpkeydisable Lib "spgp.dll" (
        ByVal KeyID As String
        ) As Long

Parameters:
KeyID The key ID of the target key. This function will only disable one key at a time.

Notes and Warnings:

up to the top

spgpKeyPassChange

Change the passphrase of a private key.

Visual Basic declaration:

Declare Function spgpkeypasschange Lib "spgp.dll" (
        ByVal KeyID As String, 
        ByVal OldPhrase As String, 
        ByVal NewPhrase As String
        ) As Long

Parameters:
KeyID The key ID of the target key.
OldPhrase The old passphrase.
NewPhrase The new passphrase.

Notes and Warnings:

up to the top

spgpKeyRemove

Delete a key from the local key-ring.

Visual Basic declaration:

Declare Function spgpkeyremove Lib "spgp.dll" (
        ByVal KeyID As String
        ) As Long

Parameters:
KeyID The key ID of the target key.

Notes and Warnings:

up to the top
Back to the Function Reference Table of Contents