PibKey Class¶
The PibKey class provides access to a key at the second level in the PIB’s’ Identity-Key-Certificate hierarchy. A PibKey object has a Name (identity + “KEY” + keyId), and contains one or more CertificateV2 objects, one of which is set as the default certificate of this key. A certificate can be directly accessed by getting a CertificateV2 object.
[C++]: | #include <ndn-cpp/security/pib/pib-key.hpp> Namespace:
ndn |
---|---|
[Python]: | Module: pyndn.security.pib |
[Java]: | Package: net.named_data.jndn.security.pib |
PibKey.getCertificate Method¶
Get the certificate with name certificateName.
[C++]: | ptr_lib::shared_ptr<PibKey> getCertificate(
const Name& certificateName
) const;
|
---|---|
[Python]: | # Returns PibKey
def getCertificate(self,
certificateName # Name
)
|
[JavaScript]: | // Returns PibKey
PibKey.prototype.getCertificate = function(
certificateName // Name
[, onComplete // function]
[, onError // function]
)
|
[Java]: | public final PibKey getCertificate(
Name certificateName
)
|
Parameters: |
|
Returns: | A copy of the CertificateV2 object. [JavaScript only: However, if onComplete is supplied then return undefined and use onComplete as described above.] |
Throw: | Pib.Error if the certificate does not exist, or an illegal argument exception if certificateName does not match the key name. |
PibKey.getDefaultCertificate Method¶
Get the default certificate for this Key.
[C++]: | ptr_lib::shared_ptr<CertificateV2> getDefaultCertificate();
|
---|---|
[Python]: | # Returns CertificateV2
def getDefaultCertificate(self)
|
[JavaScript]: | // Returns CertificateV2
PibKey.prototype.getDefaultCertificate = function(
[onComplete // function]
[, onError // function]
)
|
[Java]: | public final CertificateV2 getDefaultCertificate()
|
Parameters: |
|
Returns: | A copy of the default CertificateV2 object. [JavaScript only: However, if onComplete is supplied then return undefined and use onComplete as described above.] |
Throw: | Pib.Error if the default certificate has not been set. |
PibKey.getIdentityName Method¶
Get the name of the identity this key belongs to.
[C++]: | const Name& getIdentityName();
|
---|---|
[Python]: | # Returns Name
def getIdentityName(self)
|
[JavaScript]: | // Returns Name
PibKey.prototype.getIdentityName = function()
|
[Java]: | public final Name getIdentityName()
|
Returns: | The name of the identity. You must not modify the Key object. If you need to modify it, make a copy. |
PibKey.getKeyType Method¶
Get the key type.
[C++]: | KeyType getKeyType();
|
---|---|
[Python]: | # Returns an int from the KeyType enum
def getKeyType(self)
|
[JavaScript]: | // Returns an int from the KeyType enum.
PibKey.prototype.getKeyType = function()
|
[Java]: | public final KeyType getKeyType()
|
Returns: | The key type enum value which is RSA or EC as follows.
|
PibKey.getName Method¶
Get the key name.
[C++]: | const Name& getName();
|
---|---|
[Python]: | # Returns Name
def getName(self)
|
[JavaScript]: | // Returns Name
PibKey.prototype.getName = function()
|
[Java]: | public final Name getName()
|
Returns: | The key name. You must not modify the Key object. If you need to modify it, make a copy. |