net.robotmedia.billing.security
Class DefaultSignatureValidator

java.lang.Object
  extended by net.robotmedia.billing.security.DefaultSignatureValidator
All Implemented Interfaces:
ISignatureValidator

public class DefaultSignatureValidator
extends Object
implements ISignatureValidator


Field Summary
protected static String KEY_FACTORY_ALGORITHM
           
protected static String SIGNATURE_ALGORITHM
           
 
Constructor Summary
DefaultSignatureValidator(BillingController.IConfiguration configuration)
           
 
Method Summary
protected  PublicKey generatePublicKey(String encodedPublicKey)
          Generates a PublicKey instance from a string containing the Base64-encoded public key.
protected  boolean validate(PublicKey publicKey, String signedData, String signature)
           
 boolean validate(String signedData, String signature)
          Validates that the specified signature matches the computed signature on the specified signed data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_FACTORY_ALGORITHM

protected static final String KEY_FACTORY_ALGORITHM
See Also:
Constant Field Values

SIGNATURE_ALGORITHM

protected static final String SIGNATURE_ALGORITHM
See Also:
Constant Field Values
Constructor Detail

DefaultSignatureValidator

public DefaultSignatureValidator(BillingController.IConfiguration configuration)
Method Detail

generatePublicKey

protected PublicKey generatePublicKey(String encodedPublicKey)
Generates a PublicKey instance from a string containing the Base64-encoded public key.

Parameters:
encodedPublicKey - Base64-encoded public key
Throws:
IllegalArgumentException - if encodedPublicKey is invalid

validate

protected boolean validate(PublicKey publicKey,
                           String signedData,
                           String signature)

validate

public boolean validate(String signedData,
                        String signature)
Description copied from interface: ISignatureValidator
Validates that the specified signature matches the computed signature on the specified signed data. Returns true if the data is correctly signed.

Specified by:
validate in interface ISignatureValidator
Parameters:
signedData - signed data
signature - signature
Returns:
true if the data and signature match, false otherwise.


Copyright © 2013. All Rights Reserved.