X509CertSelector.SetSubjectPublicKey(Byte[]) Method

Definition

Sets the subjectPublicKey criterion.

[Android.Runtime.Register("setSubjectPublicKey", "([B)V", "GetSetSubjectPublicKey_arrayBHandler")]
public virtual void SetSubjectPublicKey (byte[]? key);
[<Android.Runtime.Register("setSubjectPublicKey", "([B)V", "GetSetSubjectPublicKey_arrayBHandler")>]
abstract member SetSubjectPublicKey : byte[] -> unit
override this.SetSubjectPublicKey : byte[] -> unit

Parameters

key
Byte[]

a byte array containing the subject public key in ASN.1 DER form (or null)

Attributes

Exceptions

if decoding the the public key fails.

Remarks

Sets the subjectPublicKey criterion. The X509Certificate must contain the specified subject public key. If null, no subjectPublicKey check will be done.

Because this method allows the public key to be specified as a byte array, it may be used for unknown key types.

If key is not null, it should contain a single DER encoded SubjectPublicKeyInfo structure, as defined in X.509. The ASN.1 notation for this structure is as follows.

{@code
            SubjectPublicKeyInfo  ::=  SEQUENCE  {
              algorithm            AlgorithmIdentifier,
              subjectPublicKey     BIT STRING  }

            AlgorithmIdentifier  ::=  SEQUENCE  {
              algorithm               OBJECT IDENTIFIER,
              parameters              ANY DEFINED BY algorithm OPTIONAL  }
                                         -- contains a value of the type
                                         -- registered for use with the
                                         -- algorithm object identifier value
            }

Note that the byte array supplied here is cloned to protect against subsequent modifications.

Java documentation for java.security.cert.X509CertSelector.setSubjectPublicKey(byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to