|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.handle.hdllib.Util
public abstract class Util
Field Summary | |
---|---|
static byte |
CASE_DIFF
|
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static boolean |
checkJavaVersion()
|
static int |
countValuesOfType(HandleValue[] values,
byte[] type)
|
static java.lang.String |
decodeHexString(byte[] buf,
boolean formatNicely)
|
static java.lang.String |
decodeHexString(byte[] buf,
int offset,
int len,
boolean formatNicely)
|
static java.lang.String |
decodeString(byte[] buf)
|
static java.lang.String |
decodeString(byte[] buf,
int offset,
int len)
|
static byte[] |
decrypt(byte[] ciphertext,
byte[] secretKey)
Decrypt the given set of bytes using the specified secret key |
static byte[] |
decrypt(java.security.PrivateKey privKey,
byte[] ciphertext)
|
static byte[] |
doDigest(byte digestType,
byte[] buf)
|
static byte[] |
doDigest(byte digestAlg,
byte[] buf1,
byte[] buf2,
byte[] buf3,
byte[] buf4)
|
static byte[] |
doMD5Digest(byte[] buf)
|
static byte[] |
doMD5Digest(byte[] buf1,
byte[] buf2,
byte[] buf3,
byte[] buf4)
|
static byte[] |
doSHA1Digest(byte[] buf)
|
static byte[] |
doSHA1Digest(byte[] buf1,
byte[] buf2,
byte[] buf3,
byte[] buf4)
|
static byte[] |
duplicateByteArray(byte[] buf)
|
static byte[] |
encodeHexString(java.lang.String s)
|
static byte[] |
encodeString(java.lang.String s)
Encoded the specified string into a byte array |
static byte[] |
encrypt(byte[] cleartext,
byte[] secretKey)
Encrypt the given set of bytes using the specified secret key and the default encryption algorithm. |
static byte[] |
encrypt(byte[] cleartext,
byte[] secretKey,
int encType)
Encrypt the given set of bytes using the specified secret key and encryption algorithm. |
static byte[] |
encrypt(java.security.PublicKey encryptingKey,
byte[] secretKey)
encrypt with Public key |
static byte[] |
encryptIfPossible(byte[] cleartext,
byte[] secretKey)
I know, I know, "encrypt if possible?!?!". |
static boolean |
equals(byte[] b1,
byte[] b2)
compare the two arrays. |
static boolean |
equals(byte[] b1,
int b1Start,
byte[] b2,
int b2Start)
compare the two arrays starting at the given index. |
static boolean |
equalsCI(byte[] b1,
byte[] b2)
Determine if the first parameter equals the second parameter in a case insensitive comparison. |
static boolean |
equalsCI(byte[] b1,
int b1Len,
byte[] b2,
int b2Len)
Determine if the first parameter equals the second parameter in a case insensitive manner over the given length. |
static byte[] |
getBytesFromFile(java.io.File file)
|
static byte[] |
getBytesFromFile(java.lang.String file)
convert a file into a byte stream |
static byte[] |
getBytesFromPrivateKey(java.security.PrivateKey key)
|
static byte[] |
getBytesFromPublicKey(java.security.PublicKey key)
|
static byte[] |
getHashAlgIdFromSigId(java.lang.String signatureAlgorithm)
Get the ID that the handle system uses to identify the hash algorithm used in the given signature algorithm descriptor. |
static byte[] |
getIDPart(byte[] handle)
Deprecated. use getSuffixPart(byte[]) instead |
static byte[] |
getNAHandle(byte[] handle)
Deprecated. use getZeroNAHandle(byte[]) instead |
static NamespaceInfo |
getNamespaceFromValues(HandleValue[] values)
Extract and return the namespace information contained in the given handle values. |
static byte[] |
getNAPart(byte[] handle)
Deprecated. use getPrefixPart(byte[]) instead |
static byte[] |
getParentNAOfNAHandle(byte[] naHandle)
Get the parent naming authority handle for the given naming authority handle. |
static byte[] |
getPassphrase(java.lang.String prompt)
Get a passphrase from the user. |
static byte[] |
getPrefixPart(byte[] handle)
Get only the prefix part of this handle. |
static java.security.PrivateKey |
getPrivateKeyFromBytes(byte[] pkBuf,
int offset)
|
static java.security.PrivateKey |
getPrivateKeyFromFileWithPassphrase(java.io.File privKeyFile,
java.lang.String passphrase)
|
static java.security.PublicKey |
getPublicKeyFromBytes(byte[] pkBuf,
int offset)
|
static java.security.PublicKey |
getPublicKeyFromFile(java.lang.String filename)
|
static java.lang.String |
getSigIdFromHashAlgId(byte[] hashAlgId,
java.lang.String sigKeyType)
|
static SiteInfo[] |
getSitesFromValues(HandleValue[] values)
Extract and return all of the SiteInfo records from the given list of handle values. |
static byte[] |
getSuffixPart(byte[] handle)
Get only the suffix part of this handle. |
static byte[] |
getZeroNAHandle(byte[] handle)
Get the 0.NA authority handle that applies to the specified handle |
static boolean |
hasSlash(byte[] handle)
Return whether a handle has a slash |
static int |
indexOf(byte[] b,
byte ch)
|
static boolean |
isInArray(byte[][] a,
byte[] val)
returns true if the given byte array is contained in the specified byte array array. |
static boolean |
isInArray(int[] a,
int val)
returns true if the given int value is in the specified array. |
static boolean |
isMatchingKeyPair(java.security.PublicKey pubkey,
java.security.PrivateKey privkey)
check that a given PublicKey and a given PrivateKey are a pair |
static boolean |
isParentTypeInArray(byte[][] a,
byte[] val)
Types in the array are either exact types (not ending in '.') or prefixes of type families (ending in '.'). |
static boolean |
isSubNAHandle(byte[] handle)
only for 0.NA/derived.prefix handles |
static boolean |
isValidString(byte[] buf,
int offset,
int len)
Returns true is the given byte array represents a valid text string in the encoding used by the handle system (utf8). |
static boolean |
looksLikeBinary(byte[] buf)
|
static SiteInfo[] |
orderSitesByPreference(SiteInfo[] sites)
rearranges the given sites in a more efficient order so that resolution from the current location should tend to access the faster sites first. |
static boolean |
requiresSecretKey(byte[] ciphertext)
Returns true is the given ciphertext requires a secret key to be decrypted (ie if the encryption algorithm is ENCRYPT_NONE). |
static void |
sortNumberArray(java.lang.Number[] a)
|
static boolean |
startsWith(byte[] b1,
byte[] b2)
|
static boolean |
startsWithCI(byte[] b1,
byte[] b2)
Determine if the first parameter begins with the second parameter in a case insensitive comparison. |
static byte[] |
substring(byte[] b,
int i1)
determine if the second UTF8 encoded parameter begins with the second parameter in a case sensitive comparison. |
static byte[] |
substring(byte[] b,
int i1,
int i2)
|
static byte[] |
upperCase(byte[] b)
create and return an upper-case copy of the given UTF8 byte array |
static byte[] |
upperCaseInPlace(byte[] b)
Convert all of the characters in the given utf-8 byte array to upper case. |
static boolean |
writeBytesToFile(java.io.File file,
byte[] keyBytes)
|
static boolean |
writeBytesToFile(java.lang.String file,
byte[] keyBytes)
write byte array into a given file name |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte CASE_DIFF
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static final boolean looksLikeBinary(byte[] buf)
public static final byte[] duplicateByteArray(byte[] buf)
public static final java.lang.String decodeHexString(byte[] buf, int offset, int len, boolean formatNicely)
public static final java.lang.String decodeHexString(byte[] buf, boolean formatNicely)
public static final byte[] encodeHexString(java.lang.String s)
public static final byte[] encodeString(java.lang.String s)
public static final java.lang.String decodeString(byte[] buf)
public static final java.lang.String decodeString(byte[] buf, int offset, int len)
public static final boolean isValidString(byte[] buf, int offset, int len)
public static final boolean hasSlash(byte[] handle)
@Deprecated public static final byte[] getIDPart(byte[] handle)
@Deprecated public static final byte[] getNAPart(byte[] handle)
@Deprecated public static final byte[] getNAHandle(byte[] handle)
public static final byte[] getZeroNAHandle(byte[] handle)
public static final boolean isSubNAHandle(byte[] handle)
public static final byte[] getParentNAOfNAHandle(byte[] naHandle)
public static final byte[] getPrefixPart(byte[] handle)
public static final byte[] getSuffixPart(byte[] handle)
public static final boolean startsWith(byte[] b1, byte[] b2)
public static final boolean equals(byte[] b1, byte[] b2)
public static final boolean equals(byte[] b1, int b1Start, byte[] b2, int b2Start)
public static final byte[] upperCase(byte[] b)
public static final byte[] upperCaseInPlace(byte[] b)
public static final boolean equalsCI(byte[] b1, byte[] b2)
public static final boolean equalsCI(byte[] b1, int b1Len, byte[] b2, int b2Len)
public static final boolean startsWithCI(byte[] b1, byte[] b2)
public static final byte[] substring(byte[] b, int i1)
public static final byte[] substring(byte[] b, int i1, int i2)
public static final int indexOf(byte[] b, byte ch)
public static final int countValuesOfType(HandleValue[] values, byte[] type)
public static final boolean isParentTypeInArray(byte[][] a, byte[] val)
public static final boolean isInArray(int[] a, int val)
public static final boolean isInArray(byte[][] a, byte[] val)
public static SiteInfo[] getSitesFromValues(HandleValue[] values)
public static NamespaceInfo getNamespaceFromValues(HandleValue[] values)
public static final SiteInfo[] orderSitesByPreference(SiteInfo[] sites)
public static final byte[] getPassphrase(java.lang.String prompt) throws java.lang.Exception
java.lang.Exception
public static byte[] getHashAlgIdFromSigId(java.lang.String signatureAlgorithm) throws HandleException
HandleException
public static java.lang.String getSigIdFromHashAlgId(byte[] hashAlgId, java.lang.String sigKeyType) throws HandleException
HandleException
public static byte[] getBytesFromPrivateKey(java.security.PrivateKey key) throws java.lang.Exception
java.lang.Exception
public static java.security.PrivateKey getPrivateKeyFromBytes(byte[] pkBuf, int offset) throws java.io.IOException, HandleException, java.security.spec.InvalidKeySpecException
java.io.IOException
HandleException
java.security.spec.InvalidKeySpecException
public static byte[] getBytesFromPublicKey(java.security.PublicKey key) throws java.lang.Exception
java.lang.Exception
public static java.security.PublicKey getPublicKeyFromFile(java.lang.String filename) throws java.lang.Exception
java.lang.Exception
public static java.security.PublicKey getPublicKeyFromBytes(byte[] pkBuf, int offset) throws java.lang.Exception
java.lang.Exception
public static byte[] encrypt(byte[] cleartext, byte[] secretKey) throws java.lang.Exception
java.lang.Exception
public static byte[] encrypt(byte[] cleartext, byte[] secretKey, int encType) throws java.lang.Exception
java.lang.Exception
public static byte[] encryptIfPossible(byte[] cleartext, byte[] secretKey) throws java.lang.Exception
java.lang.Exception
public static final boolean requiresSecretKey(byte[] ciphertext) throws java.lang.Exception
java.lang.Exception
public static byte[] decrypt(byte[] ciphertext, byte[] secretKey) throws java.lang.Exception
java.lang.Exception
public static final byte[] doSHA1Digest(byte[] buf) throws HandleException
HandleException
public static final byte[] doSHA1Digest(byte[] buf1, byte[] buf2, byte[] buf3, byte[] buf4) throws HandleException
HandleException
public static final byte[] doMD5Digest(byte[] buf) throws HandleException
HandleException
public static final byte[] doMD5Digest(byte[] buf1, byte[] buf2, byte[] buf3, byte[] buf4) throws HandleException
HandleException
public static final byte[] doDigest(byte digestAlg, byte[] buf1, byte[] buf2, byte[] buf3, byte[] buf4) throws HandleException
HandleException
public static final byte[] doDigest(byte digestType, byte[] buf) throws HandleException
HandleException
public static void sortNumberArray(java.lang.Number[] a)
public static byte[] encrypt(java.security.PublicKey encryptingKey, byte[] secretKey) throws java.lang.Exception
java.lang.Exception
public static byte[] getBytesFromFile(java.lang.String file)
public static byte[] getBytesFromFile(java.io.File file)
public static boolean writeBytesToFile(java.lang.String file, byte[] keyBytes)
public static boolean writeBytesToFile(java.io.File file, byte[] keyBytes)
public static boolean isMatchingKeyPair(java.security.PublicKey pubkey, java.security.PrivateKey privkey) throws HandleException
HandleException
public static byte[] decrypt(java.security.PrivateKey privKey, byte[] ciphertext) throws HandleException
HandleException
public static java.security.PrivateKey getPrivateKeyFromFileWithPassphrase(java.io.File privKeyFile, java.lang.String passphrase) throws java.lang.Exception
java.lang.Exception
public static boolean checkJavaVersion()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |