public class MAuthSignatureHelper
extends java.lang.Object
| Constructor and Description |
|---|
MAuthSignatureHelper() |
| Modifier and Type | Method and Description |
|---|---|
static java.io.SequenceInputStream |
createSequenceInputStreamV1(java.util.UUID appUUID,
java.lang.String httpMethod,
java.lang.String resourceUrl,
java.io.InputStream requestBody,
java.lang.String epochTime)
Deprecated.
|
static byte[] |
decryptSignature(java.security.PublicKey publicKey,
java.lang.String encryptedSignature)
Deprecated.
This is used for Mauth V1 protocol,
replaced by
verifyRSA(String plainText, String signature, PublicKey publicKey) for Mauth V2 protocol |
static java.lang.String |
encryptSignature(java.security.PrivateKey privateKey,
byte[] unencryptedData)
Deprecated.
This is used for Mauth V1 protocol,
replaced by
encryptSignatureRSA(PrivateKey privateKey, String unencryptedString) for Mauth V2 protocol |
static java.lang.String |
encryptSignature(java.security.PrivateKey privateKey,
java.io.InputStream inputStream)
Deprecated.
This is used for Mauth V1 protocol,
replaced by
encryptSignatureRSA(PrivateKey privateKey, String unencryptedString) for Mauth V2 protocol |
static java.lang.String |
encryptSignature(java.security.PrivateKey privateKey,
java.lang.String unencryptedString)
Deprecated.
This is used for Mauth V1 protocol,
replaced by
encryptSignatureRSA(PrivateKey privateKey, String unencryptedString) for Mauth V2 protocol |
static java.lang.String |
encryptSignatureRSA(java.security.PrivateKey privateKey,
java.lang.String unencryptedString)
Generate base64 encoded signature using SHA516 with RSA
|
static java.lang.String |
generateDigestedMessageV1(MAuthRequest mAuthRequest)
Deprecated.
|
static java.lang.String |
generateEncryptedQueryParams(java.lang.String encodedQuery)
generate the query parameters for Mauth V2
|
static java.lang.String |
generateStringToSignV2(MAuthRequest mAuthRequest)
Generate string_to_sign for Mauth V2 protocol
|
static java.lang.String |
generateStringToSignV2(java.util.UUID appUUID,
java.lang.String httpMethod,
java.lang.String resourcePath,
java.lang.String queryParameters,
byte[] requestBody,
java.lang.String epochTime)
Generate string_to_sign for Mauth V2 protocol
|
static java.lang.String |
generateStringToSignV2(java.util.UUID appUUID,
java.lang.String httpMethod,
java.lang.String resourcePath,
java.lang.String queryParameters,
java.io.InputStream requestBody,
java.lang.String epochTime)
Generate string_to_sign for Mauth V2 protocol
|
static byte[] |
generateUnencryptedSignature(java.util.UUID appUUID,
java.lang.String httpMethod,
java.lang.String resourceUrl,
byte[] requestBody,
java.lang.String epochTime)
Deprecated.
This is used for Mauth V1 protocol,
replaced by
generateStringToSignV2(UUID appUUID, String httpMethod, String resourceUrl,
String queryParameters, byte[] requestBody, String epochTime) for Mauth V2 protocol |
static java.lang.String |
generateUnencryptedSignature(java.util.UUID appUUID,
java.lang.String httpMethod,
java.lang.String resourceUrl,
java.lang.String requestBody,
java.lang.String epochTime)
Deprecated.
This is used for Mauth V1 protocol,
replaced by
generateStringToSignV2(UUID appUUID, String httpMethod, String resourceUrl,
String queryParameters, byte[] requestBody, String epochTime) for Mauth V2 protocol |
static java.lang.String |
getHexEncodedDigestedString(byte[] unencryptedData) |
static java.lang.String |
getHexEncodedDigestedString(java.io.InputStream inputStream) |
static java.lang.String |
getHexEncodedDigestedString(java.lang.String unencryptedString) |
static java.lang.String |
normalizePath(java.lang.String encodedPath)
normalize url-encoded path string
|
static boolean |
verifyRSA(java.lang.String plainText,
java.lang.String signature,
java.security.PublicKey publicKey)
Verify SHA512-RSA signature
|
@Deprecated
public static java.lang.String generateUnencryptedSignature(java.util.UUID appUUID,
java.lang.String httpMethod,
java.lang.String resourceUrl,
java.lang.String requestBody,
java.lang.String epochTime)
generateStringToSignV2(UUID appUUID, String httpMethod, String resourceUrl,
String queryParameters, byte[] requestBody, String epochTime) for Mauth V2 protocolappUUID: - app uuidhttpMethod: - Http_VerbresourceUrl: - resource_url_path (no host, port or query string; first "/" is included)requestBody: - request body stringepochTime: - current seconds since Epoch@Deprecated
public static byte[] generateUnencryptedSignature(java.util.UUID appUUID,
java.lang.String httpMethod,
java.lang.String resourceUrl,
byte[] requestBody,
java.lang.String epochTime)
throws java.io.IOException
generateStringToSignV2(UUID appUUID, String httpMethod, String resourceUrl,
String queryParameters, byte[] requestBody, String epochTime) for Mauth V2 protocolappUUID: - app uuidhttpMethod: - Http_VerbresourceUrl: - resource_url_path (no host, port or query string; first "/" is included)requestBody: - request body byte[]epochTime: - current seconds since Epochjava.io.IOException - When failed to write to ByteArrayOutputStream@Deprecated public static java.lang.String generateDigestedMessageV1(MAuthRequest mAuthRequest) throws java.io.IOException
java.io.IOException@Deprecated
public static java.io.SequenceInputStream createSequenceInputStreamV1(java.util.UUID appUUID,
java.lang.String httpMethod,
java.lang.String resourceUrl,
java.io.InputStream requestBody,
java.lang.String epochTime)
public static java.lang.String generateStringToSignV2(java.util.UUID appUUID,
java.lang.String httpMethod,
java.lang.String resourcePath,
java.lang.String queryParameters,
byte[] requestBody,
java.lang.String epochTime)
throws MAuthSigningException
appUUID: - application uuidhttpMethod: - Http_VerbresourcePath: - resource_path (Only the path segment of the URL; first "/" is included)queryParameters: - request parameters stringrequestBody: - request body byte[]epochTime: - current seconds since EpochMAuthSigningException - when generating Unencrypted Signature errorspublic static java.lang.String generateStringToSignV2(java.util.UUID appUUID,
java.lang.String httpMethod,
java.lang.String resourcePath,
java.lang.String queryParameters,
java.io.InputStream requestBody,
java.lang.String epochTime)
throws MAuthSigningException
appUUID: - application uuidhttpMethod: - Http_VerbresourcePath: - resource_path (Only the path segment of the URL; first "/" is included)queryParameters: - request parameters stringrequestBody: - request InputStreamepochTime: - current seconds since EpochMAuthSigningException - when generating Unencrypted Signature errorspublic static java.lang.String generateStringToSignV2(MAuthRequest mAuthRequest) throws MAuthSigningException
mAuthRequest: - Data from the incoming HTTP requestMAuthSigningException - when generating Unencrypted Signature errors@Deprecated
public static java.lang.String encryptSignature(java.security.PrivateKey privateKey,
java.lang.String unencryptedString)
throws java.io.IOException,
org.bouncycastle.crypto.CryptoException
encryptSignatureRSA(PrivateKey privateKey, String unencryptedString) for Mauth V2 protocolprivateKey - the private key of the identity whose signature is going to be generated.unencryptedString - the string be signedjava.io.IOExceptionorg.bouncycastle.crypto.CryptoException@Deprecated
public static java.lang.String encryptSignature(java.security.PrivateKey privateKey,
byte[] unencryptedData)
throws java.io.IOException,
org.bouncycastle.crypto.CryptoException
encryptSignatureRSA(PrivateKey privateKey, String unencryptedString) for Mauth V2 protocolprivateKey - the private key of the identity whose signature is going to be generated.unencryptedData - the bytes array be signedjava.io.IOExceptionorg.bouncycastle.crypto.CryptoException@Deprecated
public static java.lang.String encryptSignature(java.security.PrivateKey privateKey,
java.io.InputStream inputStream)
throws java.io.IOException,
org.bouncycastle.crypto.CryptoException
encryptSignatureRSA(PrivateKey privateKey, String unencryptedString) for Mauth V2 protocolprivateKey - the private key of the identity whose signature is going to be generated.inputStream - the input stream be signedjava.io.IOExceptionorg.bouncycastle.crypto.CryptoException@Deprecated
public static byte[] decryptSignature(java.security.PublicKey publicKey,
java.lang.String encryptedSignature)
verifyRSA(String plainText, String signature, PublicKey publicKey) for Mauth V2 protocolpublicKey - he public key of the identity whose signature is going to be verified.encryptedSignature - the signature to be decrypted.MAuthSigningExceptionpublic static java.lang.String getHexEncodedDigestedString(java.lang.String unencryptedString)
public static java.lang.String getHexEncodedDigestedString(byte[] unencryptedData)
public static java.lang.String getHexEncodedDigestedString(java.io.InputStream inputStream)
public static java.lang.String generateEncryptedQueryParams(java.lang.String encodedQuery)
encodedQuery - the encoded query stringpublic static java.lang.String normalizePath(java.lang.String encodedPath)
encodedPath - public static java.lang.String encryptSignatureRSA(java.security.PrivateKey privateKey,
java.lang.String unencryptedString)
throws java.security.InvalidKeyException,
java.security.NoSuchAlgorithmException,
java.security.SignatureException
privateKey - the private key of the identity whose signature is going to be generated.unencryptedString - the string be signedjava.security.InvalidKeyExceptionjava.security.NoSuchAlgorithmExceptionjava.security.SignatureExceptionpublic static boolean verifyRSA(java.lang.String plainText,
java.lang.String signature,
java.security.PublicKey publicKey)
throws java.lang.Exception
plainText - the string be verifiedsignature - the signature to be verified.publicKey - he public key of the identity whose signature is going to be verified.java.lang.Exception