public abstract class SecureLogHelper extends Object
Constructor and Description |
---|
SecureLogHelper() |
Modifier and Type | Method and Description |
---|---|
void |
bytetohex(byte b,
StringBuffer buf)
Converts a given byte to hexChar
|
boolean |
equalByteArrays(byte[] buf1,
byte[] buf2)
Finds out whether the bytes[] are equal
|
byte[] |
generateLogEntryMAC(String LogEntry)
Returns the current key from secure storage, generates the MAC and
also generates a new key and stores it back in the secure storage.
|
byte[] |
getDigest(String LogEntry,
byte[] keyMaterial)
Returns a digest based on the given LogEntry and the given KeyMaterial
|
byte[] |
getLastMAC()
Returns the last generated MAC for the logger
|
byte[] |
getLastSignatureBytes()
Returns the bytes from the last generated signature for the logger
|
String |
getLoggerFileName()
Returns the Logger File Name.
|
static String |
getLoggerKeyName()
Returns Name of Logger's Key name
|
String |
getVerifierFileName()
Returns the Verifier File Name.
|
void |
initializeSecureLogHelper(String loggerFileName,
AMPassword LoggerPassword,
String verFileName,
AMPassword verifierPassword)
Initialize logger by generating a new MACing key and storing it in
the secure storage
Also creates a file for the verifier with the same password.
|
void |
initializeVerifier(String verFileName,
AMPassword oldPassword,
AMPassword newPassword)
Initialize the verifier by using the logger generated PKCS12 file
and looking for the appropriate content in that and overwriting with
the new password
|
boolean |
isIntrusionTrue()
Compare the logger and the verifier keys
|
void |
reinitializeVerifier(String verFileName,
AMPassword password)
ReInitialize the verifier
|
void |
setLastLineforLogger(boolean islastLine)
Set the Logger's last line
|
void |
setLastLineforVerifier(boolean islastLine)
Set the Verfier's last line
|
static void |
setLoggerKeyName(String name)
Sets Name of Logger's Key name
|
abstract byte[] |
signMAC(byte[] mac)
Signs the given MAC and returns the signature
|
static byte[] |
toByteArray(String str)
Converts a given hex String separated by colons to a byte array.
|
String |
toHexString(byte[] block)
Converts a given byte block to comprehensible hexadecimal String
|
boolean |
verifyMAC(String LogEntry,
byte[] mac)
Verifies the current MAC by taking the currentVerifierKey
and update the currentVerifierKey
|
abstract boolean |
verifySignature(byte[] signedObject,
byte[] mac)
Verifies the given MAC
|
public abstract byte[] signMAC(byte[] mac) throws Exception
mac
- the mac to be signedException
- if it fails to sign the MACpublic abstract boolean verifySignature(byte[] signedObject, byte[] mac) throws Exception
signedObject
- : the signedObject to be verifiedmac
- : signed macException
- if signedObject can not be verifiedpublic void initializeSecureLogHelper(String loggerFileName, AMPassword LoggerPassword, String verFileName, AMPassword verifierPassword) throws Exception
loggerFileName
- Logger related JCEKS fileLoggerPassword
- The password for the logging JCEKS fileverFileName
- : Verifier related JCEKS fileverifierPassword
- : The password for the verifier JCEKS fileException
- if it fails to initialize SecureLogHelperpublic void initializeVerifier(String verFileName, AMPassword oldPassword, AMPassword newPassword) throws Exception
oldPassword
- This was set by the administrator and the Auditor
wants to overwrite this password.newPassword
- The administrator / auditor's new passwordException
- if it fails to replace the passwordpublic void reinitializeVerifier(String verFileName, AMPassword password) throws Exception
verFileName
- Filename of the verifierpassword
- administrator / auditor passwordException
- if it fails to reinitialize verifierpublic byte[] getLastMAC()
public byte[] getLastSignatureBytes() throws Exception
Exception
- if it fails to read the last signaturepublic String getLoggerFileName()
public String getVerifierFileName()
public byte[] generateLogEntryMAC(String LogEntry) throws Exception
LogEntry
- The actual log entryException
- if it fails to generate the MACpublic boolean verifyMAC(String LogEntry, byte[] mac) throws Exception
LogEntry
- log entry whose mac has to be verifiedmac
- mac with which to be verifiedException
- if it fails to verify mac value for log entrypublic void setLastLineforLogger(boolean islastLine)
islastLine
- true if current is last line of loggerpublic void setLastLineforVerifier(boolean islastLine)
islastLine
- true if current is last line of loggerpublic boolean isIntrusionTrue()
public String toHexString(byte[] block)
block
- The data to be convertedpublic void bytetohex(byte b, StringBuffer buf)
b
- : The byte to be convertedbuf
- : Converted data gets added herepublic static byte[] toByteArray(String str)
str
- string to be converted.public boolean equalByteArrays(byte[] buf1, byte[] buf2) throws IOException
buf1
- : First byte[] to be checkedbuf2
- : Second byte[] to be checkedIOException
- if they can not be comapredpublic byte[] getDigest(String LogEntry, byte[] keyMaterial) throws Exception
LogEntry
- : The data whose digest is to be generatedkeyMaterial
- : The key related dataException
- if it fails to generate digest value for given
LogEntry and the given KeyMaterialpublic static void setLoggerKeyName(String name)
name
- Name for Logger's Key namepublic static String getLoggerKeyName()
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.