SecureBlackbox 2020 macOS Edition

Questions / Feedback?

PGPKey Type

This container represents a PGP key.

Remarks

OpenPGP standard supports several types of keys. In our days, a typical OpenPGP keypair actually consists of two cryptographic keys: a primary key and a subkey. The primary key is normally used for signing, while the subkey is used for encryption.

While it is typical for PGP environments to use a primary key/subkey bundle, this is not a must. Sometimes you may come across standalone keys (mainly when dealing with older implementations), as well as whole key trees, each of those carrying a bunch of differently-purposed subkeys bound to the same primary key.

Algorithm-wise, OpenPGP keys also differ. Generally speaking, OpenPGP supports the following public key algorithms: RSA, Elgamal (often incorrectly referred to as DH), DSA, ECDH and ECDSA. When it comes to primary key/subkey bundles, DSA/Elgamal, RSA/RSA and ECDSA/ECDH pairs are typically used. Although there's no restriction on algorithm bundles, and, e.g. a ECDSA/Elgamal key bundle is perfectly possible, such combination is rarely used in practice.

A typical OpenPGP key is associated with some kind of user ID (Username). It is normally represented with a user's e-mail address, while in theory can be any piece of text. The secret part of the OpenPGP keypair is protected with a password (Passphrase).

Fields

bitsInKey
Int32

Indicates the key length in bits.

canEncrypt
Bool

Returns True if this key can be used for encryption.

canSign
Bool

Returns True if this key can be used for signing.

curve
String

Indicates the elliptic curve associated with a EC key.

Supported values:

SB_PGP_CURVE_P256P256
SB_PGP_CURVE_P384P384
SB_PGP_CURVE_P521P521
SB_PGP_CURVE_ED25519ED25519
SB_PGP_CURVE_CURVE25519CURVE25519
SB_PGP_CURVE_BRAINPOOLP256R1BRAINPOOLP256
SB_PGP_CURVE_BRAINPOOLP512R1BRAINPOOLP512

enabled
Bool

Enables or disables this key for use in encryption or signing operation.

encryptionAlgorithm
String

Indicates the symmetric algorithm used to encrypt the secret key.

expires
Int32

Indicates key expiration time in whole days from its generation moment. The value of 0 indicates that the key does not expire.

handle
Int64

Allows to get or set a 'handle', a unique identifier of the underlying property object. Use this property to assign objects of the same type in a quicker manner, without copying them fieldwise.

When you pass a handle of one object to another, the source object is copied to the destination rather than assigned. It is safe to get rid of the original object after such operation.

  pdfSigner.setSigningCertHandle(certMgr.getCertHandle());

hashAlgorithm
String

Specifies the hash algorithm associated with the key.

isPublic
Bool

Returns True if this key is a public key, and False otherwise.

isSecret
Bool

Returns True if this key is a secret key, and False otherwise.

isSubkey
Bool

Returns True if this key is a subkey of another key, and False otherwise.

keyFP
String

The 20-byte fingerprint (hash value) of this key.

KeyFP could be used to distinguish two keys with the same KeyID.

keyHashAlgorithm
String

Specifies the hash algorithm used with DSA keys to calculate signatures.

keyID
String

Contains a 8-byte key identifier.

It is quite rare that IDs of two keys collide. If that happens, their fingerprints (KeyFP) can be used for distinguish between the keys. Please note that many PGP implementations show only 4 lowest bytes of the KeyID to the user.

oldPacketFormat
Bool

Indicates whether legacy (PGP 2.6.x) packet format should be used.

passphrase
String

The key protection password.

passphraseValid
Bool

Use this property to check whether the specified Passphrase is valid and can be used to unlock the secret key.

primaryKeyID
String

If this key is a subkey (IsSubkey returns True), this property contains the identifier of the subkey's primary key.

protection
PGPProtectionTypes

Specifies the level of protection applied to the secret key.

Allowed values:

pptNone0Key is not encrypted
pptLow1Only the password hash is used to derive the secret key
pptNormal2Password hash with salt is used to derive the secret key
pptHigh3Hash from multiple passwords and salt are used for key derivation

publicKeyAlgorithm
String

Specifies the asymmetric algorithm of the key.

qBits
Int32

The length of the DSA Q (legitimate range: 160-512).

This parameter corresponds to the hash algorithm used with the key. For example, if the value of Q is 256, SHA-256 will be used.

revoked
Bool

Returns True if the key has been revoked, and False otherwise.

subkeyFP
String

The 20-byte fingerprint (hash value) of this key's subkey.

KeyFP could be used to distinguish two subkeys with the same SubkeyID.

subkeyID
String

Contains a 8-byte subkey identifier.

It is quite rare that IDs of two keys collide. If that happens, their fingerprints (SubkeyFP) can be used to distinguish between the keys. Please note that many PGP implementations show only 4 lowest bytes of the KeyID to the user.

timestamp
String

Use this property to check the time the key was generated. The date and time are stored and retrieved in Universal Coordinate Time (UTC).

username
String

Specifies the name of the user bound to this key.

The PGP username is typically represented with a full name and an email address, but generally can be any non-empty string.

valid
PGPKeyValidities

Indicates the validity status of the key.

pkvStrictlyValid0Strictly valid

pkvValid1Valid

pkvInvalid2Invalid

pkvFailure3Generic validation failure

pkvUnknown4Validity unknown

version
Int32

Indicates the key version.

The key version refers to the version of the public-key packet format as defined in RFC 4880.

Only two versions are currently allowed here: 3 and 4. It is recommended that all new keys are created with version of 4.

Constructors

public init()

Creates an empty PGP key object.

Copyright (c) 2022 /n software inc. - All rights reserved.
SecureBlackbox 2020 macOS Edition - Version 20.0 [Build 8165]