DESedeKeySpec
Stay organized with collections
Save and categorize content based on your preferences.
This class specifies a DES-EDE ("triple-DES") key.
Constant Summary
int |
DES_EDE_KEY_LEN |
The constant which defines the length of a DESede key in bytes. |
Public Constructor Summary
|
DESedeKeySpec(byte[] key)
Creates a DESedeKeySpec object using the first 24 bytes in
key as the key material for the DES-EDE key.
|
|
DESedeKeySpec(byte[] key, int offset)
Creates a DESedeKeySpec object using the first 24 bytes in
key , beginning at offset inclusive,
as the key material for the DES-EDE key.
|
Public Method Summary
byte[]
|
getKey()
Returns the DES-EDE key.
|
static
boolean
|
isParityAdjusted(byte[] key, int offset)
Checks if the given DES-EDE key, starting at offset
inclusive, is parity-adjusted.
|
Inherited Method Summary
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals( Object obj)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait(long timeout, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long timeout)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
Constants
public
static
final
int
DES_EDE_KEY_LEN
The constant which defines the length of a DESede key in bytes.
Constant Value:
24
Public Constructors
public
DESedeKeySpec
(byte[] key)
Creates a DESedeKeySpec object using the first 24 bytes in
key
as the key material for the DES-EDE key.
The bytes that constitute the DES-EDE key are those between
key[0]
and key[23]
inclusive
Parameters
key |
the buffer with the DES-EDE key material. The first
24 bytes of the buffer are copied to protect against subsequent
modification. |
public
DESedeKeySpec
(byte[] key, int offset)
Creates a DESedeKeySpec object using the first 24 bytes in
key
, beginning at offset
inclusive,
as the key material for the DES-EDE key.
The bytes that constitute the DES-EDE key are those between
key[offset]
and key[offset+23]
inclusive.
Parameters
key |
the buffer with the DES-EDE key material. The first
24 bytes of the buffer beginning at offset inclusive
are copied to protect against subsequent modification. |
offset |
the offset in key , where the DES-EDE key
material starts. |
Public Methods
public
byte[]
getKey
()
Returns
- the DES-EDE key. Returns a new array
each time this method is called.
public
static
boolean
isParityAdjusted
(byte[] key, int offset)
Checks if the given DES-EDE key, starting at offset
inclusive, is parity-adjusted.
Parameters
key |
a byte array which holds the key value |
offset |
the offset into the byte array |
Returns
- true if the given DES-EDE key is parity-adjusted, false
otherwise
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eDESedeKeySpec\u003c/code\u003e specifies a DES-EDE (triple-DES) key using a 24-byte key material.\u003c/p\u003e\n"],["\u003cp\u003eIt provides constructors to create a \u003ccode\u003eDESedeKeySpec\u003c/code\u003e object from a byte array containing the key material.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve the DES-EDE key using the \u003ccode\u003egetKey()\u003c/code\u003e method and check for parity adjustment using \u003ccode\u003eisParityAdjusted()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eA constant, \u003ccode\u003eDES_EDE_KEY_LEN\u003c/code\u003e, defines the key length as 24 bytes.\u003c/p\u003e\n"]]],[],null,["public class **DESedeKeySpec** extends [Object](../../../../reference/java/lang/Object.html) \nimplements [KeySpec](../../../../reference/java/security/spec/KeySpec.html) \nThis class specifies a DES-EDE (\"triple-DES\") key. \n\nConstant Summary\n\n|-----|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------|\n| int | [DES_EDE_KEY_LEN](../../../../reference/javax/crypto/spec/DESedeKeySpec.html#DES_EDE_KEY_LEN) | The constant which defines the length of a DESede key in bytes. |\n\nPublic Constructor Summary\n\n|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [DESedeKeySpec](../../../../reference/javax/crypto/spec/DESedeKeySpec.html#DESedeKeySpec(byte[]))(byte\\[\\] key) Creates a DESedeKeySpec object using the first 24 bytes in `key` as the key material for the DES-EDE key. |\n| | [DESedeKeySpec](../../../../reference/javax/crypto/spec/DESedeKeySpec.html#DESedeKeySpec(byte[],%20int))(byte\\[\\] key, int offset) Creates a DESedeKeySpec object using the first 24 bytes in `key`, beginning at `offset` inclusive, as the key material for the DES-EDE key. |\n\nPublic Method Summary\n\n|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| byte\\[\\] | [getKey](../../../../reference/javax/crypto/spec/DESedeKeySpec.html#getKey())() Returns the DES-EDE key. |\n| static boolean | [isParityAdjusted](../../../../reference/javax/crypto/spec/DESedeKeySpec.html#isParityAdjusted(byte[],%20int))(byte\\[\\] key, int offset) Checks if the given DES-EDE key, starting at `offset` inclusive, is parity-adjusted. |\n\nInherited Method Summary \nFrom class [java.lang.Object](../../../../reference/java/lang/Object.html) \n\n|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Object](../../../../reference/java/lang/Object.html) | [clone](../../../../reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |\n| boolean | [equals](../../../../reference/java/lang/Object.html#equals(java.lang.Object))([Object](../../../../reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |\n| void | [finalize](../../../../reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |\n| final [Class](../../../../reference/java/lang/Class.html)\\\u003c?\\\u003e | [getClass](../../../../reference/java/lang/Object.html#getClass())() Returns the unique instance of [Class](../../../../reference/java/lang/Class.html) that represents this object's class. |\n| int | [hashCode](../../../../reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |\n| final void | [notify](../../../../reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |\n| final void | [notifyAll](../../../../reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |\n| [String](../../../../reference/java/lang/String.html) | [toString](../../../../reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |\n| final void | [wait](../../../../reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |\n| final void | [wait](../../../../reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |\n| final void | [wait](../../../../reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |\n\nConstants \n\npublic static final int\n**DES_EDE_KEY_LEN** \nThe constant which defines the length of a DESede key in bytes. \nConstant Value: 24\n\nPublic Constructors \n\npublic\n**DESedeKeySpec**\n(byte\\[\\] key) \nCreates a DESedeKeySpec object using the first 24 bytes in\n`key` as the key material for the DES-EDE key.\n\nThe bytes that constitute the DES-EDE key are those between\n`key[0]` and `key[23]` inclusive \n\nParameters\n\n| key | the buffer with the DES-EDE key material. The first 24 bytes of the buffer are copied to protect against subsequent modification. |\n|-----|-----------------------------------------------------------------------------------------------------------------------------------|\n\nThrows\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if `key` is null. |\n| [InvalidKeyException](../../../../reference/java/security/InvalidKeyException.html) | if the given key material is shorter than 24 bytes. |\n|-------------------------------------------------------------------------------------|-----------------------------------------------------|\n\npublic\n**DESedeKeySpec**\n(byte\\[\\] key, int offset) \nCreates a DESedeKeySpec object using the first 24 bytes in\n`key`, beginning at `offset` inclusive,\nas the key material for the DES-EDE key.\n\nThe bytes that constitute the DES-EDE key are those between\n`key[offset]` and `key[offset+23]` inclusive. \n\nParameters\n\n| key | the buffer with the DES-EDE key material. The first 24 bytes of the buffer beginning at `offset` inclusive are copied to protect against subsequent modification. |\n| offset | the offset in `key`, where the DES-EDE key material starts. |\n|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\nThrows\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if `key` is null. |\n| [InvalidKeyException](../../../../reference/java/security/InvalidKeyException.html) | if the given key material, starting at `offset` inclusive, is shorter than 24 bytes |\n|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|\n\nPublic Methods \n\npublic byte\\[\\]\n**getKey**\n() \nReturns the DES-EDE key. \n\nReturns\n\n- the DES-EDE key. Returns a new array each time this method is called. \n\npublic static boolean\n**isParityAdjusted**\n(byte\\[\\] key, int offset) \nChecks if the given DES-EDE key, starting at `offset`\ninclusive, is parity-adjusted. \n\nParameters\n\n| key | a byte array which holds the key value |\n| offset | the offset into the byte array |\n|--------|----------------------------------------|\n\nReturns\n\n- true if the given DES-EDE key is parity-adjusted, false otherwise \n\nThrows\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if `key` is null. |\n| [InvalidKeyException](../../../../reference/java/security/InvalidKeyException.html) | if the given key material, starting at `offset` inclusive, is shorter than 24 bytes |\n|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|"]]