new PolicyManager()
A PolicyManager is an abstract base class to represent the policy for
verifying data packets. You must create an object of a subclass.
- Source:
Methods
(static) verifySignature(signature, signedBlob, publicKeyDer, onComplete)
Check the type of signature and use the publicKeyDer to verify the
signedBlob using the appropriate signature algorithm.
Parameters:
Name | Type | Description |
---|---|---|
signature |
Signature | An object of a subclass of Signature, e.g. Sha256WithRsaSignature. |
signedBlob |
SignedBlob | the SignedBlob with the signed portion to verify. |
publicKeyDer |
Blob | The DER-encoded public key used to verify the signature. |
onComplete |
function | This calls onComplete(true) if the signature verifies, otherwise onComplete(false). |
Throws:
SecurityException if the signature type is not recognized or if
publicKeyDer can't be decoded.
checkSigningPolicy(dataName, certificateName) → {boolean}
Check if the signing certificate name and data name satisfy the signing
policy.
Your derived class should override.
Parameters:
Name | Type | Description |
---|---|---|
dataName |
Name | The name of data to be signed. |
certificateName |
Name | The name of signing certificate. |
Returns:
True if the signing certificate can be used to sign the
data, otherwise false.
- Type
- boolean
checkVerificationPolicy(dataOrInterest, stepCount, onVerified, onValidationFailed, wireFormat) → {ValidationRequest}
Check whether the received data or interest packet complies with the
verification policy, and get the indication of the next verification step.
Your derived class should override.
Parameters:
Name | Type | Description |
---|---|---|
dataOrInterest |
Data | Interest | The Data object or interest with the signature to check. |
stepCount |
number | The number of verification steps that have been done, used to track the verification progress. |
onVerified |
function | If the signature is verified, this calls onVerified(dataOrInterest). NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions. |
onValidationFailed |
function | If the signature check fails, this calls onValidationFailed(dataOrInterest, reason). NOTE: The library will log any exceptions thrown by this callback, but for better error handling the callback should catch and properly handle any exceptions. |
wireFormat |
WireFormat |
- Source:
Returns:
The indication of next verification step, or
null if there is no further step.
- Type
- ValidationRequest
inferSigningIdentity(dataName) → {Name}
Infer the signing identity name according to the policy. If the signing
identity cannot be inferred, return an empty name.
Your derived class should override.
Parameters:
Name | Type | Description |
---|---|---|
dataName |
Name | The name of data to be signed. |
Returns:
The signing identity or an empty name if cannot infer.
- Type
- Name
requireVerify(dataOrInterest) → {boolean}
Check if this PolicyManager has a verification rule for the received data
packet or signed interest.
Your derived class should override.
Parameters:
Name | Type | Description |
---|---|---|
dataOrInterest |
Data | Interest | The received data packet or interest. |
- Source:
Returns:
True if the data or interest must be verified, otherwise
false.
- Type
- boolean
skipVerifyAndTrust(dataOrInterest) → {boolean}
Check if the received data packet or signed interest can escape from
verification and be trusted as valid.
Your derived class should override.
Parameters:
Name | Type | Description |
---|---|---|
dataOrInterest |
Data | Interest | The received data packet or interest. |
- Source:
Returns:
True if the data or interest does not need to be verified
to be trusted as valid, otherwise false.
- Type
- boolean