Condividi tramite


KeyStore.SetKeyEntry Method

Definition

Overloads

SetKeyEntry(String, Byte[], Certificate[])

Assigns the given key (that has already been protected) to the given alias.

SetKeyEntry(String, IKey, Char[], Certificate[])

Assigns the given key to the given alias, protecting it with the given password.

SetKeyEntry(String, Byte[], Certificate[])

Assigns the given key (that has already been protected) to the given alias.

[Android.Runtime.Register("setKeyEntry", "(Ljava/lang/String;[B[Ljava/security/cert/Certificate;)V", "")]
public void SetKeyEntry (string? alias, byte[]? key, Java.Security.Cert.Certificate[]? chain);
[<Android.Runtime.Register("setKeyEntry", "(Ljava/lang/String;[B[Ljava/security/cert/Certificate;)V", "")>]
member this.SetKeyEntry : string * byte[] * Java.Security.Cert.Certificate[] -> unit

Parameters

alias
String

the alias name

key
Byte[]

the key (in protected format) to be associated with the alias

chain
Certificate[]

the certificate chain for the corresponding public key (only useful if the protected key is of type java.security.PrivateKey).

Attributes

Exceptions

if this KeyStore is not initialized or if key is null.

if key is a PrivateKey and chain does.

if alias is null.

Remarks

Assigns the given key (that has already been protected) to the given alias.

If the protected key is of type java.security.PrivateKey, it must be accompanied by a certificate chain certifying the corresponding public key. If the underlying keystore implementation is of type jks, key must be encoded as an EncryptedPrivateKeyInfo as defined in the PKCS #8 standard.

If the given alias already exists, the keystore information associated with it is overridden by the given key (and possibly certificate chain).

Java documentation for java.security.KeyStore.setKeyEntry(java.lang.String, byte[], java.security.cert.Certificate[]).

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

SetKeyEntry(String, IKey, Char[], Certificate[])

Assigns the given key to the given alias, protecting it with the given password.

[Android.Runtime.Register("setKeyEntry", "(Ljava/lang/String;Ljava/security/Key;[C[Ljava/security/cert/Certificate;)V", "")]
public void SetKeyEntry (string? alias, Java.Security.IKey? key, char[]? password, Java.Security.Cert.Certificate[]? chain);
[<Android.Runtime.Register("setKeyEntry", "(Ljava/lang/String;Ljava/security/Key;[C[Ljava/security/cert/Certificate;)V", "")>]
member this.SetKeyEntry : string * Java.Security.IKey * char[] * Java.Security.Cert.Certificate[] -> unit

Parameters

alias
String

the alias name

key
IKey

the key to be associated with the alias

password
Char[]

the password to protect the key

chain
Certificate[]

the certificate chain for the corresponding public key (only required if the given key is of type java.security.PrivateKey).

Attributes

Exceptions

if this KeyStore is not initialized.

if key is a PrivateKey and chain does not contain any certificates.

if alias is null.

Remarks

Assigns the given key to the given alias, protecting it with the given password.

If the given key is of type java.security.PrivateKey, it must be accompanied by a certificate chain certifying the corresponding public key.

If the given alias already exists, the keystore information associated with it is overridden by the given key (and possibly certificate chain).

Java documentation for java.security.KeyStore.setKeyEntry(java.lang.String, java.security.Key, char[], java.security.cert.Certificate[]).

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