Back to the Function Reference Table of Contents
Data Analysis Functions
- spgpAnalyze
Analyzes data and reports as to whether the data is encrypted, signed, etc.
- spgpAnalyzeFile
Analyzes a file and reports as to whether the data is encrypted, signed, etc.
- spgpAnalyzeEx
Analyzes data and reports as to whether the data is encrypted, signed, etc., and returns extended information.
- spgpAnalyzeFileEx
Analyzes a file and reports as to whether the data is encrypted, signed, etc., and returns extended information.
For analysis of key-blocks, see also:
spgpKeyImport
spgpKeyImportFile
Analyzes data and reports as to whether the data is encrypted, signed, etc.
Visual Basic declaration:
Declare Function spgpanalyze Lib "spgp.dll" (ByVal BufferIn As String) As Long
Parameters:
Notes and Warnings:
up to the top
Analyzes a file and reports as to whether the data is encrypted, signed, etc.
Visual Basic declaration:
Declare Function spgpanalyzefile Lib "spgp.dll" (ByVal FileIn As String) As Long
Parameters:
FileIn
|
The file to be analyzed.
|
Notes and Warnings:
up to the top
Like spgpAnalyze, this function analyzes data and reports as to whether the data is encrypted, signed, etc. It offers extended functionality by (i) adding return codes to identify conventionally encrypted data and data for which there are no available decryption keys, and (ii) returning via a buffer a report on the keys to which the data has been encrypted.
Visual Basic declaration:
Declare Function spgpanalyzeex Lib "spgp.dll" (
ByVal BufferIn As String,
ByVal BufferOut As String,
ByVal BufferOutLen As Long
) As Long
Parameters:
BufferIn
|
A fixed-length string which will act as a buffer for input.
|
BufferOut
|
A fixed-length string which will act as a buffer for output.
|
BufferOutLen
|
Size of BufferOut. If output exceeds BufferOutLen the output will be discarded and the function will return a positive number indicating the size of the output (i.e. the buffer size necessary to hold it).
|
Notes and Warnings:
- The non-error values returned by this function are as follows:
Encrypted = 0
Signed = 1
Detached Signature = 2
Key = 3
Unknown = 4
Conventional Encryption = 5
Encrypted No Key = 6
The above values are declared as constants in SPGP.BAS. All other values should be treated as error codes.
Note that within the context of spgpAnalyze, "Encrypted" indicates either public-key or conventional encryption, but in the context of spgpAnalyzeEx, "Encrypted" indicates public-key encryption for which at least one private key is available for decryption on the local key-ring. Conventional encryption is indicated by "Conventional Encryption". "Encrypted No Key" indicates public-key encryption for which there are no private keys available for decryption on the local key-ring.
- If the function returns either "0" or "6" the information contained in BufferOut will be in the following format:
Keys_Unknown: [ integer ]
Keys_Known: [ integer ]
[ known keys ]
"Keys_Unknown" will be followed by the number of public keys to which the data has been encrypted and for which there are no corresponding private keys available for decryption on the local key-ring.
"Keys_Known" will be followed by the number of public keys to which the data has been encrypted and for which there are private keys available for decryption on the local key-ring. If the number is greater than zero, the next line will contain a list of Key IDs identifying the keys. You can get the complete properties of the key by passing the Key ID to spgpKeyProps.
Example of output:
Function returns: 0
BufferOut contains:
Keys_Unknown: 1
Keys_Known: 1
0xD71F6FE5
In the above example, the data is encrypted to two public keys, but only one corresponding private key is on the local key-ring. The available private key is identifed by KeyID on the following line. Note that the function returns "0" as long as there is at least one private key available. The function only returns "6" when no private keys are available.
- It is not possible at present to identify the keys listed as "unknown", but this is planned for a future release.
- If a block of text contains more than one Lexical Section, the first section only will be analyzed.
- Data which has been encrypted and signed will be reported as encrypted, only.
- Data which has been ASCII-armored without encryption or signing will be reported as signed. This is a flaw in the PGPsdk.
up to the top
Like spgpAnalyzeFile, this function analyzes a file and reports as to whether the data is encrypted, signed, etc. It offers extended functionality by (i) adding return codes to identify conventionally encrypted data and data for which there are no available decryption keys, and (ii) returning via a buffer a report on the keys to which the data has been encrypted.
Visual Basic declaration:
Declare Function spgpanalyzefileex Lib "spgp.dll" (
ByVal FileIn As String,
ByVal BufferOut As String,
ByVal BufferOutLen As Long
) As Long
Parameters:
FileIn
|
The file to be analyzed.
|
BufferOut
|
A fixed-length string which will act as a buffer for output.
|
BufferOutLen
|
Size of BufferOut. If output exceeds BufferOutLen the output will be discarded and the function will return a positive number indicating the size of the output (i.e. the buffer size necessary to hold it).
|
Notes and Warnings:
Please see spgpAnalyzeEx.
up to the top
Back to the Function Reference Table of Contents