@Override public BootstrapSession begin(String endpoint, Identity clientIdentity) { boolean authorized; if (bsSecurityStore != null) { List<SecurityInfo> securityInfos = bsSecurityStore.getAllByEndpoint(endpoint); authorized = securityChecker.checkSecurityInfos(endpoint, clientIdentity, securityInfos); } else { authorized = true; } return new DefaultBootstrapSession(endpoint, clientIdentity, authorized); }
@Override public byte[] getKey(String identity) { SecurityInfo info = bsSecurityStore.getByIdentity(identity); if (info == null || info.getPreSharedKey() == null) { return null; } else { // defensive copy return Arrays.copyOf(info.getPreSharedKey(), info.getPreSharedKey().length); } }