java.lang.Object
com.pi4j.crowpi.components.internal.rfid.MifareKey
Helper class for authenticating against MIFARE cards using either Key A or Key B.
Provides
getDefaultKeyA()
and getDefaultKeyB()
for retrieving the factory default keys (all FF).-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
All available key types on MIFARE cards -
Constructor Summary
ConstructorDescriptionMifareKey
(MifareKey.Type type, byte[] bytes) Creates a new MIFARE key which can be used for authenticating against a card. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getBytes()
Returns the raw content / bytes for this key.static MifareKey
Returns the default factory key (six times 0xFF) to be used asMifareKey.Type.KEY_A
.static MifareKey
Returns the default factory key (six times 0xFF) to be used asMifareKey.Type.KEY_B
.int
Returns the length of this key, should always be 6.getType()
Returns the type of this key.
-
Constructor Details
-
MifareKey
Creates a new MIFARE key which can be used for authenticating against a card.- Parameters:
type
- Type of authentication keybytes
- Contents of key, must be exactly 6 bytes
-
-
Method Details
-
getDefaultKeyA
Returns the default factory key (six times 0xFF) to be used asMifareKey.Type.KEY_A
.- Returns:
- Instance of default key A
-
getDefaultKeyB
Returns the default factory key (six times 0xFF) to be used asMifareKey.Type.KEY_B
.- Returns:
- Instance of default key B
-
getBytes
public byte[] getBytes()Returns the raw content / bytes for this key.- Returns:
- Byte array of key contents
-
getLength
public int getLength()Returns the length of this key, should always be 6.- Returns:
- Length of key
-
getType
Returns the type of this key.- Returns:
- Type of key
-