net.named_data.jndn.security.policy
public abstract class PolicyManager extends Object
Constructor and Description |
---|
PolicyManager() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
checkSigningPolicy(Name dataName,
Name certificateName)
Check if the signing certificate name and data name satisfy the signing
policy.
|
abstract ValidationRequest |
checkVerificationPolicy(Data data,
int stepCount,
OnVerified onVerified,
OnVerifyFailed onVerifyFailed)
Check whether the received data packet complies with the verification
policy, and get the indication of the next verification step.
|
ValidationRequest |
checkVerificationPolicy(Interest interest,
int stepCount,
OnVerifiedInterest onVerified,
OnVerifyInterestFailed onVerifyFailed) |
abstract ValidationRequest |
checkVerificationPolicy(Interest interest,
int stepCount,
OnVerifiedInterest onVerified,
OnVerifyInterestFailed onVerifyFailed,
WireFormat wireFormat)
Check whether the received signed interest complies with the verification
policy, and get the indication of the next verification step.
|
abstract Name |
inferSigningIdentity(Name dataName)
Infer the signing identity name according to the policy.
|
abstract boolean |
requireVerify(Data data)
Check if this PolicyManager has a verification rule for the received data.
|
abstract boolean |
requireVerify(Interest interest)
Check if this PolicyManager has a verification rule for the received interest.
|
abstract boolean |
skipVerifyAndTrust(Data data)
Check if the received data packet can escape from verification and be
trusted as valid.
|
abstract boolean |
skipVerifyAndTrust(Interest interest)
Check if the received signed interest can escape from verification and be
trusted as valid.
|
protected static boolean |
verifyDigestSha256Signature(Blob signature,
SignedBlob signedBlob)
Verify the DigestSha256 signature on the SignedBlob by verifying that the
digest of SignedBlob equals the signature.
|
protected static boolean |
verifySha256WithEcdsaSignature(Blob signature,
SignedBlob signedBlob,
Blob publicKeyDer)
Verify the ECDSA signature on the SignedBlob using the given public key.
|
protected static boolean |
verifySha256WithRsaSignature(Blob signature,
SignedBlob signedBlob,
Blob publicKeyDer)
Verify the RSA signature on the SignedBlob using the given public key.
|
protected static boolean |
verifySignature(Signature signature,
SignedBlob signedBlob,
Blob publicKeyDer)
Check the type of signature and use the publicKeyDer to verify the
signedBlob using the appropriate signature algorithm.
|
public abstract boolean skipVerifyAndTrust(Data data)
data
- The received data packet.public abstract boolean skipVerifyAndTrust(Interest interest)
interest
- The received interest.public abstract boolean requireVerify(Data data)
data
- The received data packet.public abstract boolean requireVerify(Interest interest)
interest
- The received interest.public abstract ValidationRequest checkVerificationPolicy(Data data, int stepCount, OnVerified onVerified, OnVerifyFailed onVerifyFailed) throws SecurityException
data
- The Data object with the signature to check.stepCount
- The number of verification steps that have been done,
used to track the verification progress.onVerified
- If the signature is verified, this calls
onVerified(data).
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.onVerifyFailed
- If the signature check fails, this calls
onVerifyFailed(data).
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.SecurityException
public abstract ValidationRequest checkVerificationPolicy(Interest interest, int stepCount, OnVerifiedInterest onVerified, OnVerifyInterestFailed onVerifyFailed, WireFormat wireFormat) throws SecurityException
interest
- The interest with the signature to check.stepCount
- The number of verification steps that have been done, used
to track the verification progress.onVerified
- If the signature is verified, this calls
onVerified.onVerifiedInterest(interest).
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.onVerifyFailed
- If the signature check fails, this calls
onVerifyFailed.onVerifyInterestFailed(interest).
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.SecurityException
public ValidationRequest checkVerificationPolicy(Interest interest, int stepCount, OnVerifiedInterest onVerified, OnVerifyInterestFailed onVerifyFailed) throws SecurityException
SecurityException
public abstract boolean checkSigningPolicy(Name dataName, Name certificateName)
dataName
- The name of data to be signed.certificateName
- The name of signing certificate.public abstract Name inferSigningIdentity(Name dataName)
dataName
- The name of data to be signed.protected static boolean verifySignature(Signature signature, SignedBlob signedBlob, Blob publicKeyDer) throws SecurityException
signature
- An object of a subclass of Signature, e.g.
Sha256WithRsaSignature.signedBlob
- the SignedBlob with the signed portion to verify.publicKeyDer
- The DER-encoded public key used to verify the signature.
This may be null if the signature type does not require a public key.SecurityException
- if the signature type is not recognized or if
publicKeyDer can't be decoded.protected static boolean verifySha256WithRsaSignature(Blob signature, SignedBlob signedBlob, Blob publicKeyDer) throws SecurityException
signature
- The signature bits.signedBlob
- the SignedBlob with the signed portion to verify.publicKeyDer
- The DER-encoded public key used to verify the signature.SecurityException
protected static boolean verifySha256WithEcdsaSignature(Blob signature, SignedBlob signedBlob, Blob publicKeyDer) throws SecurityException
signature
- The signature bits.signedBlob
- the SignedBlob with the signed portion to verify.publicKeyDer
- The DER-encoded public key used to verify the signature.SecurityException
protected static boolean verifyDigestSha256Signature(Blob signature, SignedBlob signedBlob)
signature
- The signature bits.signedBlob
- the SignedBlob with the signed portion to verify.Copyright © 2016. All rights reserved.