public static String getSignedURLWithCustomPolicy(final Protocol protocol,
                                            final String distributionDomain,
                                            final File privateKeyFile,
                                            final String s3ObjectKey,
                                            final String keyPairId,
                                            final Date dateLessThan,
                                            final Date dateGreaterThan,
                                            final String ipRange)
            throws InvalidKeySpecException, IOException {
        PrivateKey privateKey = loadPrivateKey(privateKeyFile);
        final String resourcePath = generateResourcePath(protocol, distributionDomain, s3ObjectKey);
        String policy = buildCustomPolicyForSignedUrl(resourcePath, dateLessThan, ipRange, dateGreaterThan);
        return getSignedURLWithCustomPolicy(resourcePath, keyPairId, privateKey, policy);
    }
Returns a signed URL that provides tailored access to private content
based on an access time window and an ip range.
For more information, see <a href=
"http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-urls-overview.html"
>Overview of Signed URLs</a>.

@param protocol
           The protocol of the URL
@param distributionDomain
           The domain name of the distribution
@param privateKeyFile
           Your private key file. RSA private key (.pem) and pkcs8 (.der)
           files are supported.
@param s3ObjectKey
           The s3 key of the object, or the name of the stream for rtmp
@param keyPairId
           The key pair id corresponding to the private key file given
@param dateLessThan
           The expiration date of the signed URL in UTC
@param dateGreaterThan
           The beginning valid date of the signed URL in UTC
@param ipRange
           The allowed IP address range of the client making the GET
           request, in CIDR form (e.g. 192.168.0.1/24).
@return The signed URL.
@throws IOException
@throws InvalidKeySpecException
aws-java-sdk-cloudfront/src/main/java/com/amazonaws/services/cloudfront/CloudFrontUrlSigner.java