C# Class Amazon.CloudFront.AmazonCloudFrontUrlSigner

Mostra file Open project: aws/aws-sdk-net Class Usage Examples

Public Methods

Method Description
BuildPolicyForSignedUrl ( string resourcePath, System.DateTime expiresOn, string limitToIpAddressCIDR ) : string

Generate a policy document that describes custom access permissions to apply via a private distribution's signed URL.

BuildPolicyForSignedUrl ( string resourcePath, System.DateTime expiresOn, string limitToIpAddressCIDR, System.DateTime activeFrom ) : string

Generate a policy document that describes custom access permissions to apply via a private distribution's signed URL.

GetCannedSignedURL ( Protocol protocol, string distributionDomain, FileSystemInfo privateKey, string resourcePath, string keyPairId, System.DateTime expiresOn ) : string

Returns a signed URL that grants universal access to private content until a given date.

GetCannedSignedURL ( Protocol protocol, string distributionDomain, TextReader privateKey, string resourcePath, string keyPairId, System.DateTime expiresOn ) : string

Returns a signed URL that grants universal access to private content until a given date.

GetCannedSignedURL ( string url, TextReader privateKey, string keyPairId, System.DateTime expiresOn ) : string

Returns a signed URL that grants universal access to private content until a given date.

GetCustomSignedURL ( Protocol protocol, string distributionDomain, FileSystemInfo privateKey, string resourcePath, string keyPairId, System.DateTime expiresOn, System.DateTime activeFrom, string ipRange ) : string

Returns a signed URL that provides tailored access to private content based on an access time window and an ip range.

GetCustomSignedURL ( Protocol protocol, string distributionDomain, TextReader privateKey, string resourcePath, string keyPairId, System.DateTime expiresOn, System.DateTime activeFrom, string ipRange ) : string

Returns a signed URL that provides tailored access to private content based on an access time window and an ip range.

GetCustomSignedURL ( Protocol protocol, string distributionDomain, TextReader privateKey, string resourcePath, string keyPairId, System.DateTime expiresOn, string ipRange ) : string

Returns a signed URL that provides tailored access to private content based on an access time window and an ip range.

GetCustomSignedURL ( string url, TextReader privateKey, string keyPairId, System.DateTime expiresOn, System.DateTime activeFrom, string ipRange ) : string

Returns a signed URL that provides tailored access to private content based on an access time window and an ip range.

GetCustomSignedURL ( string url, TextReader privateKey, string keyPairId, System.DateTime expiresOn, string ipRange ) : string

Returns a signed URL that provides tailored access to private content based on an access time window and an ip range.

SignUrl ( string resourceUrlOrPath, string keyPairId, FileInfo privateKey, string policy ) : string

Generate a signed URL that allows access to distribution and resource path by applying access restrictions specified in a custom policy document.

SignUrl ( string resourceUrlOrPath, string keyPairId, TextReader privateKey, string policy ) : string

Generate a signed URL that allows access to distribution and resource path by applying access restrictions specified in a custom policy document.

SignUrlCanned ( string resourceUrlOrPath, string keyPairId, FileInfo privateKey, System.DateTime expiresOn ) : String

Generate a signed URL that allows access to a specific distribution and resource path by applying a access restrictions from a "canned" (simplified) policy document.

SignUrlCanned ( string resourceUrlOrPath, string keyPairId, TextReader privateKey, System.DateTime expiresOn ) : String

Generate a signed URL that allows access to a specific distribution and resource path by applying a access restrictions from a "canned" (simplified) policy document.

Private Methods

Method Description
ConvertPEMToRSAParameters ( TextReader privateKeyReader ) : RSAParameters
GenerateResourcePath ( Protocol protocol, string distributionDomain, string path ) : string

Returns the resource path for the given distribution, object, and protocol.

GetRSAPKCS1SignatureFromSHA1 ( byte hashedData, RSA providerRSA ) : byte[]
GetSHA1Provider ( ) : SHA1
MakeBytesUrlSafe ( byte bytes ) : string

Converts the given data to be safe for use in signed URLs for a private distribution by using specialized Base64 encoding.

MakeStringUrlSafe ( string str ) : String

Converts the given string to be safe for use in signed URLs for a private distribution.

SignWithSha1RSA ( byte dataToSign, RSAParameters rsaParameters ) : byte[]

Signs the data given with the private key given, using the SHA1withRSA algorithm provided by bouncy castle.

Method Details

BuildPolicyForSignedUrl() public static method

Generate a policy document that describes custom access permissions to apply via a private distribution's signed URL.
public static BuildPolicyForSignedUrl ( string resourcePath, System.DateTime expiresOn, string limitToIpAddressCIDR ) : string
resourcePath string /// An optional HTTP/S or RTMP resource path that restricts which /// distribution and resource path will be accessible in a signed /// URL. For standard distributions the resource URL will be /// "http://" + distributionName + "/" + path (may /// also include URL parameters. For distributions with the HTTPS /// required protocol, the resource URL must start with /// "https://". RTMP resources do not take the form of a /// URL, and instead the resource path is nothing but the stream's /// name. The '*' and '?' characters can be used as a wildcards to /// allow multi-character or single-character matches /// respectively: ///
    ///
  • * : All distributions/objects will be accessible
  • ///
  • a1b2c3d4e5f6g7.cloudfront.net/* : All objects /// within the distribution a1b2c3d4e5f6g7 will be accessible
  • ///
  • a1b2c3d4e5f6g7.cloudfront.net/path/to/object.txt /// : Only the resource named path/to/object.txt in the /// distribution a1b2c3d4e5f6g7 will be accessible.
  • ///
/// If this parameter is null the policy will permit access to all /// distributions and resource path associated with the certificate /// keypair used to generate the signed URL. ///
expiresOn System.DateTime The time and date when the signed URL will expire.
limitToIpAddressCIDR string An optional range of client IP addresses that will be allowed /// to access the distribution, specified as a CIDR range. If /// null, the CIDR will be 0.0.0.0/0 and any client will /// be permitted.
return string

BuildPolicyForSignedUrl() public static method

Generate a policy document that describes custom access permissions to apply via a private distribution's signed URL.
public static BuildPolicyForSignedUrl ( string resourcePath, System.DateTime expiresOn, string limitToIpAddressCIDR, System.DateTime activeFrom ) : string
resourcePath string /// An optional HTTP/S or RTMP resource path that restricts which /// distribution and S3 objects will be accessible in a signed /// URL. For standard distributions the resource URL will be /// "http://" + distributionName + "/" + path (may /// also include URL parameters. For distributions with the HTTPS /// required protocol, the resource URL must start with /// "https://". RTMP resources do not take the form of a /// URL, and instead the resource path is nothing but the stream's /// name. The '*' and '?' characters can be used as a wildcards to /// allow multi-character or single-character matches /// respectively: ///
    ///
  • * : All distributions/objects will be accessible
  • ///
  • a1b2c3d4e5f6g7.cloudfront.net/* : All objects /// within the distribution a1b2c3d4e5f6g7 will be accessible
  • ///
  • a1b2c3d4e5f6g7.cloudfront.net/path/to/object.txt /// : Only the S3 object named path/to/object.txt in the /// distribution a1b2c3d4e5f6g7 will be accessible.
  • ///
/// If this parameter is null the policy will permit access to all /// distributions and S3 objects associated with the certificate /// keypair used to generate the signed URL. ///
expiresOn System.DateTime The time and date when the signed URL will expire.
limitToIpAddressCIDR string An optional range of client IP addresses that will be allowed /// to access the distribution, specified as a CIDR range. If /// null, the CIDR will be 0.0.0.0/0 and any client will /// be permitted.
activeFrom System.DateTime An optional UTC time and date when the signed URL will become /// active. A value of DateTime.MinValue (the default value of DateTime) is ignored. ///
return string

GetCannedSignedURL() public static method

Returns a signed URL that grants universal access to private content until a given date.
public static GetCannedSignedURL ( Protocol protocol, string distributionDomain, FileSystemInfo privateKey, string resourcePath, string keyPairId, System.DateTime expiresOn ) : string
protocol Protocol The protocol of the URL
distributionDomain string The domain name of the distribution
privateKey System.IO.FileSystemInfo The private key file. RSA private key (.pem) are supported.
resourcePath string The path for the resource, or the name of the stream for rtmp
keyPairId string The key pair id corresponding to the private key file given.
expiresOn System.DateTime The expiration date of the signed URL
return string

GetCannedSignedURL() public static method

Returns a signed URL that grants universal access to private content until a given date.
public static GetCannedSignedURL ( Protocol protocol, string distributionDomain, TextReader privateKey, string resourcePath, string keyPairId, System.DateTime expiresOn ) : string
protocol Protocol The protocol of the URL
distributionDomain string The domain name of the distribution
privateKey TextReader The private key file. RSA private key (.pem) are supported.
resourcePath string The path for the resource, or the name of the stream for rtmp
keyPairId string The key pair id corresponding to the private key file given.
expiresOn System.DateTime The expiration date of the signed URL
return string

GetCannedSignedURL() public static method

Returns a signed URL that grants universal access to private content until a given date.
public static GetCannedSignedURL ( string url, TextReader privateKey, string keyPairId, System.DateTime expiresOn ) : string
url string The full url (protocol + domain + resource path) to the resource, or the name of the stream for rtmp
privateKey TextReader The private key file. RSA private key (.pem) are supported.
keyPairId string The key pair id corresponding to the private key file given.
expiresOn System.DateTime The expiration date of the signed URL
return string

GetCustomSignedURL() public static method

Returns a signed URL that provides tailored access to private content based on an access time window and an ip range.
public static GetCustomSignedURL ( Protocol protocol, string distributionDomain, FileSystemInfo privateKey, string resourcePath, string keyPairId, System.DateTime expiresOn, System.DateTime activeFrom, string ipRange ) : string
protocol Protocol The protocol of the URL
distributionDomain string The domain name of the distribution
privateKey System.IO.FileSystemInfo Your private key file. RSA private key (.pem) are supported.
resourcePath string The path for the resource, or the name of the stream for rtmp
keyPairId string The key pair id corresponding to the private key file given
expiresOn System.DateTime The expiration date of the signed URL
activeFrom System.DateTime The beginning valid date of the signed URL
ipRange string The allowed IP address range of the client making the GET request, in CIDR form (e.g. 192.168.0.1/24).
return string

GetCustomSignedURL() public static method

Returns a signed URL that provides tailored access to private content based on an access time window and an ip range.
public static GetCustomSignedURL ( Protocol protocol, string distributionDomain, TextReader privateKey, string resourcePath, string keyPairId, System.DateTime expiresOn, System.DateTime activeFrom, string ipRange ) : string
protocol Protocol The protocol of the URL
distributionDomain string The domain name of the distribution
privateKey TextReader Your private key file. RSA private key (.pem) are supported.
resourcePath string The path for the resource, or the name of the stream for rtmp
keyPairId string The key pair id corresponding to the private key file given
expiresOn System.DateTime The expiration date of the signed URL
activeFrom System.DateTime The beginning valid date of the signed URL
ipRange string The allowed IP address range of the client making the GET request, in CIDR form (e.g. 192.168.0.1/24).
return string

GetCustomSignedURL() public static method

Returns a signed URL that provides tailored access to private content based on an access time window and an ip range.
public static GetCustomSignedURL ( Protocol protocol, string distributionDomain, TextReader privateKey, string resourcePath, string keyPairId, System.DateTime expiresOn, string ipRange ) : string
protocol Protocol The protocol of the URL
distributionDomain string The domain name of the distribution
privateKey TextReader Your private key file. RSA private key (.pem) are supported.
resourcePath string The path for the resource, or the name of the stream for rtmp
keyPairId string The key pair id corresponding to the private key file given
expiresOn System.DateTime The expiration date of the signed URL
ipRange string The allowed IP address range of the client making the GET request, in CIDR form (e.g. 192.168.0.1/24).
return string

GetCustomSignedURL() public static method

Returns a signed URL that provides tailored access to private content based on an access time window and an ip range.
public static GetCustomSignedURL ( string url, TextReader privateKey, string keyPairId, System.DateTime expiresOn, System.DateTime activeFrom, string ipRange ) : string
url string The protocol of the URL
privateKey TextReader Your private key file. RSA private key (.pem) are supported.
keyPairId string The key pair id corresponding to the private key file given
expiresOn System.DateTime The expiration date of the signed URL
activeFrom System.DateTime The beginning valid date of the signed URL
ipRange string The allowed IP address range of the client making the GET request, in CIDR form (e.g. 192.168.0.1/24).
return string

GetCustomSignedURL() public static method

Returns a signed URL that provides tailored access to private content based on an access time window and an ip range.
public static GetCustomSignedURL ( string url, TextReader privateKey, string keyPairId, System.DateTime expiresOn, string ipRange ) : string
url string The protocol of the URL
privateKey TextReader Your private key file. RSA private key (.pem) are supported.
keyPairId string The key pair id corresponding to the private key file given
expiresOn System.DateTime The expiration date of the signed URL
ipRange string The allowed IP address range of the client making the GET request, in CIDR form (e.g. 192.168.0.1/24).
return string

SignUrl() public static method

Generate a signed URL that allows access to distribution and resource path by applying access restrictions specified in a custom policy document.
public static SignUrl ( string resourceUrlOrPath, string keyPairId, FileInfo privateKey, string policy ) : string
resourceUrlOrPath string /// The URL or path that uniquely identifies a resource within a /// distribution. For standard distributions the resource URL will /// be "http://" + distributionName + "/" + path /// (may also include URL parameters. For distributions with the /// HTTPS required protocol, the resource URL must start with /// "https://". RTMP resources do not take the form of a /// URL, and instead the resource path is nothing but the stream's /// name. ///
keyPairId string Identifier of a public/private certificate keypair already configured in your Amazon Web Services account.
privateKey System.IO.FileInfo The RSA private key data that corresponding to the certificate keypair identified by keyPairId.
policy string A policy document that describes the access permissions that will be applied by /// the signed URL. To generate a custom policy use
return string

SignUrl() public static method

Generate a signed URL that allows access to distribution and resource path by applying access restrictions specified in a custom policy document.
public static SignUrl ( string resourceUrlOrPath, string keyPairId, TextReader privateKey, string policy ) : string
resourceUrlOrPath string /// The URL or path that uniquely identifies a resource within a /// distribution. For standard distributions the resource URL will /// be "http://" + distributionName + "/" + path /// (may also include URL parameters. For distributions with the /// HTTPS required protocol, the resource URL must start with /// "https://". RTMP resources do not take the form of a /// URL, and instead the resource path is nothing but the stream's /// name. ///
keyPairId string Identifier of a public/private certificate keypair already configured in your Amazon Web Services account.
privateKey TextReader The RSA private key data that corresponding to the certificate keypair identified by keyPairId.
policy string A policy document that describes the access permissions that will be applied by /// the signed URL. To generate a custom policy use
return string

SignUrlCanned() public static method

Generate a signed URL that allows access to a specific distribution and resource path by applying a access restrictions from a "canned" (simplified) policy document.
public static SignUrlCanned ( string resourceUrlOrPath, string keyPairId, FileInfo privateKey, System.DateTime expiresOn ) : String
resourceUrlOrPath string /// The URL or path that uniquely identifies a resource within a /// distribution. For standard distributions the resource URL will /// be "http://" + distributionName + "/" + path /// (may also include URL parameters. For distributions with the /// HTTPS required protocol, the resource URL must start with /// "https://". RTMP resources do not take the form of a /// URL, and instead the resource path is nothing but the stream's /// name. ///
keyPairId string Identifier of a public/private certificate keypair already configured in your Amazon Web Services account.
privateKey System.IO.FileInfo The RSA private key data that corresponding to the certificate keypair identified by keyPairId.
expiresOn System.DateTime The time and date when the signed URL will expire.
return String

SignUrlCanned() public static method

Generate a signed URL that allows access to a specific distribution and resource path by applying a access restrictions from a "canned" (simplified) policy document.
public static SignUrlCanned ( string resourceUrlOrPath, string keyPairId, TextReader privateKey, System.DateTime expiresOn ) : String
resourceUrlOrPath string /// The URL or path that uniquely identifies a resource within a /// distribution. For standard distributions the resource URL will /// be "http://" + distributionName + "/" + path /// (may also include URL parameters. For distributions with the /// HTTPS required protocol, the resource URL must start with /// "https://". RTMP resources do not take the form of a /// URL, and instead the resource path is nothing but the stream's /// name. ///
keyPairId string Identifier of a public/private certificate keypair already configured in your Amazon Web Services account.
privateKey TextReader The RSA private key data that corresponding to the certificate keypair identified by keyPairId.
expiresOn System.DateTime The time and date when the signed URL will expire.
return String