Class: Google::Apis::AndroidmanagementV1::ChoosePrivateKeyRule

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/androidmanagement_v1/classes.rb,
lib/google/apis/androidmanagement_v1/representations.rb,
lib/google/apis/androidmanagement_v1/representations.rb

Overview

Controls apps' access to private keys. The rule determines which private key, if any, Android Device Policy grants to the specified app. Access is granted either when the app calls KeyChain.choosePrivateKeyAlias (https://developer. android.com/reference/android/security/KeyChain#choosePrivateKeyAlias% 28android.app.Activity,%20android.security.KeyChainAliasCallback,%20java.lang. String[],%20java.security.Principal[],%20java.lang.String,%20int,%20java.lang. String%29) (or any overloads) to request a private key alias for a given URL, or for rules that are not URL-specific (that is, if urlPattern is not set, or set to the empty string or .*) on Android 11 and above, directly so that the app can call KeyChain.getPrivateKey (https://developer.android.com/reference/ android/security/KeyChain#getPrivateKey%28android.content.Context,%20java.lang. String%29), without first having to call KeyChain.choosePrivateKeyAlias.When an app calls KeyChain.choosePrivateKeyAlias if more than one choosePrivateKeyRules matches, the last matching rule defines which key alias to return.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ ChoosePrivateKeyRule

Returns a new instance of ChoosePrivateKeyRule.



1042
1043
1044
# File 'lib/google/apis/androidmanagement_v1/classes.rb', line 1042

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#package_namesArray<String>

The package names to which this rule applies. The hash of the signing certificate for each app is verified against the hash provided by Play. If no package names are specified, then the alias is provided to all apps that call KeyChain.choosePrivateKeyAlias (https://developer.android.com/reference/ android/security/KeyChain#choosePrivateKeyAlias%28android.app.Activity,% 20android.security.KeyChainAliasCallback,%20java.lang.String[],%20java. security.Principal[],%20java.lang.String,%20int,%20java.lang.String%29) or any overloads (but not without calling KeyChain.choosePrivateKeyAlias, even on Android 11 and above). Any app with the same Android UID as a package specified here will have access when they call KeyChain.choosePrivateKeyAlias. Corresponds to the JSON property packageNames

Returns:

  • (Array<String>)


1028
1029
1030
# File 'lib/google/apis/androidmanagement_v1/classes.rb', line 1028

def package_names
  @package_names
end

#private_key_aliasString

The alias of the private key to be used. Corresponds to the JSON property privateKeyAlias

Returns:

  • (String)


1033
1034
1035
# File 'lib/google/apis/androidmanagement_v1/classes.rb', line 1033

def private_key_alias
  @private_key_alias
end

#url_patternString

The URL pattern to match against the URL of the request. If not set or empty, it matches all URLs. This uses the regular expression syntax of java.util. regex.Pattern. Corresponds to the JSON property urlPattern

Returns:

  • (String)


1040
1041
1042
# File 'lib/google/apis/androidmanagement_v1/classes.rb', line 1040

def url_pattern
  @url_pattern
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1047
1048
1049
1050
1051
# File 'lib/google/apis/androidmanagement_v1/classes.rb', line 1047

def update!(**args)
  @package_names = args[:package_names] if args.key?(:package_names)
  @private_key_alias = args[:private_key_alias] if args.key?(:private_key_alias)
  @url_pattern = args[:url_pattern] if args.key?(:url_pattern)
end