public class SecureResolver
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
SecureResolver.HDLSignature |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_ALGORITHM |
boolean |
ignoreInvalidSignatures |
boolean |
ignoreUnsignedValues |
static byte[] |
METADATA_TYPE |
boolean |
reportMissingValues |
static java.lang.String |
SIG_ALG_TAGNAME |
static java.lang.String |
SIG_HANDLE_ATTRIBUTE |
static java.lang.String |
SIG_TAGNAME |
static byte[] |
SIGNATURE_TYPE |
static java.lang.String |
SIGNED_INDEX_TAGNAME |
static java.lang.String |
SIGNER_HANDLE_ATTRIBUTE |
static java.lang.String |
SIGNER_INDEX_ATTRIBUTE |
boolean |
traceMessages |
static int |
VALUE_DIGEST_OFFSET |
static java.lang.String |
VALUE_HASH_ELEMENT_NAME |
static java.lang.String |
VALUE_INDEX_ATTRIBUTE |
static java.lang.String |
VALUE_MD5HASH_ATTRIBUTE |
static java.lang.String |
VALUE_SHA1HASH_ATTRIBUTE |
| Constructor and Description |
|---|
SecureResolver()
Construct a SecureResolver using a new instance of the default
HandleResolver to process resolution requests.
|
SecureResolver(HandleResolver resolver)
Construct a SecureResolver using the given HandleResolver
to process resolution requests.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
createDigestOfValues(java.lang.String handle,
HandleValue[] values)
Generate an XML string containing the metadata (including digests) for the given set
of handle values
|
java.security.PublicKey |
getTrustedKey(ValueReference valRef) |
static void |
main(java.lang.String[] argv) |
void |
printState() |
HandleValue[] |
resolveHandle(byte[] handle,
byte[][] types,
int[] indexes)
Resolve the given handle retrieving only the given types and indexes,
if any.
|
HandleValue[] |
resolveHandle(ResolutionRequest req)
Process the given ResolutionRequest while verifying that any values returned are
signed according to the policy of this object.
|
HandleValue[] |
secureHandleValues(byte[] handle,
HandleValue[] values) |
HandleValue[] |
secureHandleValues(byte[] handle,
HandleValue[] aValues,
java.util.Map<ValueReference,java.security.PublicKey> keys) |
void |
setRootKeysAsTrusted() |
void |
setTrustedKeys(java.util.Map<ValueReference,java.security.PublicKey> keyIDsMap)
Specify the set of identities that are trusted to verify handle values.
|
void |
setTrustNamespaceKeys(boolean trustThem)
Sets whether or not the resolver should trust keys that are provided by
higher level namespaces (ie contained in naming authority handles).
|
java.util.List<SecureResolver.HDLSignature> |
signaturesFromValue(java.lang.String handle,
HandleValue sigValue,
HandleValue[] allValues) |
java.util.List<SecureResolver.HDLSignature> |
signaturesFromValues(java.lang.String handle,
HandleValue[] allValues) |
static java.lang.String |
signValue(java.lang.String signerHDL,
int signerIndex,
java.security.PrivateKey privKey,
java.lang.String signedHDL,
HandleValue valueToBeSigned)
Sign some handle value data (usually a table of handle value digests) with the given
signer's public key.
|
static boolean |
valueNeedsSignature(HandleValue value) |
HandleValue[] |
verifyValuesByMajority(byte[] handle,
HandleValue[] aValues)
Verify the given handle values and return only those which have been signed
by a majority of the public keys in the given key map.
|
public static final java.lang.String SIGNED_INDEX_TAGNAME
public static final java.lang.String SIG_ALG_TAGNAME
public static final java.lang.String SIG_TAGNAME
public static final java.lang.String DEFAULT_ALGORITHM
public static final java.lang.String VALUE_HASH_ELEMENT_NAME
public static final java.lang.String VALUE_INDEX_ATTRIBUTE
public static final java.lang.String SIG_HANDLE_ATTRIBUTE
public static final java.lang.String SIGNER_HANDLE_ATTRIBUTE
public static final java.lang.String SIGNER_INDEX_ATTRIBUTE
public static final java.lang.String VALUE_MD5HASH_ATTRIBUTE
public static final java.lang.String VALUE_SHA1HASH_ATTRIBUTE
public static final int VALUE_DIGEST_OFFSET
public static final byte[] METADATA_TYPE
public static final byte[] SIGNATURE_TYPE
public boolean ignoreUnsignedValues
public boolean reportMissingValues
public boolean ignoreInvalidSignatures
public boolean traceMessages
public SecureResolver()
public SecureResolver(HandleResolver resolver)
public void printState()
public void setRootKeysAsTrusted()
public void setTrustedKeys(java.util.Map<ValueReference,java.security.PublicKey> keyIDsMap)
public java.security.PublicKey getTrustedKey(ValueReference valRef)
public void setTrustNamespaceKeys(boolean trustThem)
public HandleValue[] resolveHandle(byte[] handle, byte[][] types, int[] indexes) throws HandleException
HandleExceptionpublic HandleValue[] resolveHandle(ResolutionRequest req) throws HandleException
HandleExceptionpublic HandleValue[] secureHandleValues(byte[] handle, HandleValue[] values) throws java.lang.Exception
java.lang.Exceptionpublic HandleValue[] secureHandleValues(byte[] handle, HandleValue[] aValues, java.util.Map<ValueReference,java.security.PublicKey> keys) throws java.lang.Exception
java.lang.Exceptionpublic java.util.List<SecureResolver.HDLSignature> signaturesFromValue(java.lang.String handle, HandleValue sigValue, HandleValue[] allValues) throws java.lang.Exception
java.lang.Exceptionpublic java.util.List<SecureResolver.HDLSignature> signaturesFromValues(java.lang.String handle, HandleValue[] allValues) throws java.lang.Exception
java.lang.Exceptionpublic static final java.lang.String createDigestOfValues(java.lang.String handle,
HandleValue[] values)
throws HandleException,
java.security.NoSuchAlgorithmException
HandleExceptionjava.security.NoSuchAlgorithmExceptionpublic static final java.lang.String signValue(java.lang.String signerHDL,
int signerIndex,
java.security.PrivateKey privKey,
java.lang.String signedHDL,
HandleValue valueToBeSigned)
throws HandleException,
java.security.NoSuchAlgorithmException,
java.security.SignatureException,
java.security.InvalidKeyException
HandleExceptionjava.security.NoSuchAlgorithmExceptionjava.security.SignatureExceptionjava.security.InvalidKeyExceptionpublic static void main(java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exceptionpublic HandleValue[] verifyValuesByMajority(byte[] handle, HandleValue[] aValues) throws java.lang.Exception
java.lang.Exceptionpublic static boolean valueNeedsSignature(HandleValue value)