次の方法で共有


SecretKeySpec Constructors

Definition

Overloads

SecretKeySpec(Byte[], String)

Constructs a secret key from the given byte array.

SecretKeySpec(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

SecretKeySpec(Byte[], Int32, Int32, String)

Constructs a secret key from the given byte array, using the first len bytes of key, starting at offset inclusive.

SecretKeySpec(Byte[], String)

Constructs a secret key from the given byte array.

[Android.Runtime.Register(".ctor", "([BLjava/lang/String;)V", "")]
public SecretKeySpec (byte[]? key, string? algorithm);
[<Android.Runtime.Register(".ctor", "([BLjava/lang/String;)V", "")>]
new Javax.Crypto.Spec.SecretKeySpec : byte[] * string -> Javax.Crypto.Spec.SecretKeySpec

Parameters

key
Byte[]

the key material of the secret key. The contents of the array are copied to protect against subsequent modification.

algorithm
String

the name of the secret-key algorithm to be associated with the given key material. See Appendix A in the Java Cryptography Architecture Reference Guide for information about standard algorithm names.

Attributes

Exceptions

if the key data or the algorithm name is null or if the key data is empty.

Remarks

Constructs a secret key from the given byte array.

This constructor does not check if the given bytes indeed specify a secret key of the specified algorithm. For example, if the algorithm is DES, this constructor does not check if key is 8 bytes long, and also does not check for weak or semi-weak keys. In order for those checks to be performed, an algorithm-specific key specification class (in this case: DESKeySpec DESKeySpec) should be used.

Java documentation for javax.crypto.spec.SecretKeySpec.SecretKeySpec(byte[], java.lang.String).

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

SecretKeySpec(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected SecretKeySpec (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Javax.Crypto.Spec.SecretKeySpec : nativeint * Android.Runtime.JniHandleOwnership -> Javax.Crypto.Spec.SecretKeySpec

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

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

SecretKeySpec(Byte[], Int32, Int32, String)

Constructs a secret key from the given byte array, using the first len bytes of key, starting at offset inclusive.

[Android.Runtime.Register(".ctor", "([BIILjava/lang/String;)V", "")]
public SecretKeySpec (byte[]? key, int offset, int len, string? algorithm);
[<Android.Runtime.Register(".ctor", "([BIILjava/lang/String;)V", "")>]
new Javax.Crypto.Spec.SecretKeySpec : byte[] * int * int * string -> Javax.Crypto.Spec.SecretKeySpec

Parameters

key
Byte[]

the key material of the secret key. The first len bytes of the array beginning at offset inclusive are copied to protect against subsequent modification.

offset
Int32

the offset in key where the key material starts.

len
Int32

the length of the key material.

algorithm
String

the name of the secret-key algorithm to be associated with the given key material. See Appendix A in the Java Cryptography Architecture Reference Guide for information about standard algorithm names.

Attributes

Exceptions

if the key data or the algorithm name is null, the key data is empty or offset and len do not specify a valid chunk in the buffer key.

if offset or len is negative.

Remarks

Constructs a secret key from the given byte array, using the first len bytes of key, starting at offset inclusive.

The bytes that constitute the secret key are those between key[offset] and key[offset+len-1] inclusive.

This constructor does not check if the given bytes indeed specify a secret key of the specified algorithm. For example, if the algorithm is DES, this constructor does not check if key is 8 bytes long, and also does not check for weak or semi-weak keys. In order for those checks to be performed, an algorithm-specific key specification class (in this case: DESKeySpec DESKeySpec) must be used.

Java documentation for javax.crypto.spec.SecretKeySpec.SecretKeySpec(byte[], int, int, java.lang.String).

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