28import org.jau.util.BasicTypes;
81 public static KeyType get(
final String name)
throws IllegalArgumentException {
90 public static KeyType get(
final byte value) {
92 case (
byte) 0x00:
return COMBI;
93 case (
byte) 0x01:
return LOCAL_UNIT;
94 case (
byte) 0x02:
return REMOTE_UNIT;
95 case (
byte) 0x03:
return DBG_COMBI;
96 case (
byte) 0x04:
return UNAUTH_COMBI_P192;
97 case (
byte) 0x05:
return AUTH_COMBI_P192;
98 case (
byte) 0x06:
return CHANGED_COMBI;
99 case (
byte) 0x07:
return UNAUTH_COMBI_P256;
100 case (
byte) 0x08:
return AUTH_COMBI_P256;
101 default:
return NONE;
152 public void get(
final byte[] source,
int pos) {
153 if(
byte_size > ( source.length - pos ) ) {
154 throw new IllegalArgumentException(
"Stream ( "+source.length+
" - "+pos+
" ) < "+
byte_size+
" bytes");
158 System.arraycopy(source, pos,
key, 0, 16); pos+=16;
173 public final void put(
final byte[] sink,
int pos) {
174 if(
byte_size > ( sink.length - pos ) ) {
175 throw new IllegalArgumentException(
"Stream ( "+sink.length+
" - "+pos+
" ) < "+
byte_size+
" bytes");
177 sink[pos++] =
responder ? (byte)1 : (
byte)0;
179 System.arraycopy(
key, 0, sink, pos, 16); pos+=16;
190 ", key "+BasicTypes.bytesHexString(
key, 0, -1,
true )+
Local SMP Link Key, used for platform agnostic persistence, mapping to platform specific link keys fo...
KeyType type
KeyType value.
SMPLinkKey(final byte source[], final int pos)
Construct instance via given source byte array.
final boolean isResponder()
byte pin_length
Pin length.
SMPLinkKey()
Construct emoty unset instance.
static final int byte_size
Size of the byte stream representation in bytes.
boolean responder
Responder (ll slave) flag.
final void put(final byte[] sink, int pos)
Method transfers all bytes representing this instance into the given destination array at the given p...
Link Key Types compatible with Mgmt's MgmtLinkKeyType and hence MgmtLinkKeyInfo.
DBG_COMBI
Debug Combination key.
UNAUTH_COMBI_P192
Unauthenticated Combination key from P-192.
NONE
Denoting no or invalid link key type.
CHANGED_COMBI
Changed Combination key.
REMOTE_UNIT
Remote Unit key.
static KeyType get(final String name)
Maps the specified name to a constant of KeyType.
LOCAL_UNIT
Local Unit key.
AUTH_COMBI_P256
Authenticated Combination key from P-256.
AUTH_COMBI_P192
Authenticated Combination key from P-192.
UNAUTH_COMBI_P256
Unauthenticated Combination key from P-256.