org.alfresco.encryption
Class MACUtils
java.lang.Object
org.alfresco.encryption.MACUtils
public class MACUtils
- extends java.lang.Object
Provides support for generating and checking MACs (Message Authentication Codes) using Alfresco's
secret keys.
- Since:
- 4.0
Nested Class Summary |
static class |
MACUtils.MACInput
Represents the information to be fed into the MAC generator |
Constructor Summary |
MACUtils()
Default constructor for IOC |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MACUtils
public MACUtils()
- Default constructor for IOC
setKeyProvider
public void setKeyProvider(KeyProvider keyProvider)
setMacAlgorithm
public void setMacAlgorithm(java.lang.String macAlgorithm)
getMac
protected javax.crypto.Mac getMac(java.lang.String keyAlias)
throws java.lang.Exception
- Throws:
java.lang.Exception
longToByteArray
protected byte[] longToByteArray(long l)
throws java.io.IOException
- Throws:
java.io.IOException
generateMAC
public byte[] generateMAC(java.lang.String keyAlias,
MACUtils.MACInput macInput)
validateMAC
public boolean validateMAC(java.lang.String keyAlias,
byte[] expectedMAC,
MACUtils.MACInput macInput)
- Compares the expectedMAC against the MAC generated from
Assumes message has been decrypted
- Parameters:
keyAlias
- expectedMAC
- timestamp
- ipAddress
- message
-
- Returns:
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.