Package org.sdnplatform.sync.error

Examples of org.sdnplatform.sync.error.AuthException


    protected void handshakeChallengeResponse(HelloMessage request,
                                              Channel channel)
                                                      throws AuthException {
        AuthChallengeResponse cr = request.getAuthChallengeResponse();
        if (cr == null) {
            throw new AuthException("No authentication data in " +
                    "handshake message");
        }
        if (cr.isSetResponse()) {
            authenticateResponse(currentChallenge, cr.getResponse());
            currentChallenge = null;
            channelState = ChannelState.AUTHENTICATED;
            handleHello(request, channel);
        } else if (cr.isSetChallenge()) {
            HelloMessage m = new HelloMessage();
            if (getLocalNodeId() != null)
                m.setNodeId(getLocalNodeId());
            AsyncMessageHeader header = new AsyncMessageHeader();
            header.setTransactionId(getTransactionId());
            m.setHeader(header);
            SyncMessage bsm = new SyncMessage(MessageType.HELLO);
            bsm.setHello(m);

            AuthChallengeResponse reply = new AuthChallengeResponse();
            reply.setResponse(generateResponse(cr.getChallenge()));
            m.setAuthChallengeResponse(reply);
            channel.write(bsm);
        } else {
            throw new AuthException("No authentication data in " +
                    "handshake message");
        }
    }
View Full Code Here


        byte[] expectedBytes = DatatypeConverter.parseBase64Binary(expected);
        byte[] reponseBytes = DatatypeConverter.parseBase64Binary(response);
       
        if (!Arrays.equals(expectedBytes, reponseBytes)) {
            throw new AuthException("Challenge response does not match " +
                                    "expected response");
        }
    }
View Full Code Here

                new SecretKeySpec(secretBytes, "HmacSHA1");
        Mac mac;
        try {
            mac = Mac.getInstance("HmacSHA1");
        } catch (NoSuchAlgorithmException e) {
            throw new AuthException("Could not initialize HmacSHA1 algorithm",
                                    e);
        }
        try {
            mac.init(signingKey);
            byte[] output =
                    mac.doFinal(DatatypeConverter.parseBase64Binary(challenge));
            return DatatypeConverter.printBase64Binary(output);           
        } catch (InvalidKeyException e) {
            throw new AuthException("Invalid shared secret; could not " +
                    "authenticate response", e);
        }
    }
View Full Code Here

    protected byte[] getSharedSecret() throws AuthException {
        try {
            return CryptoUtil.getSharedSecret(syncManager.keyStorePath,
                                              syncManager.keyStorePassword);
        } catch (Exception e) {
            throw new AuthException("Could not read challenge/response " +
                    "shared secret from key store " +
                    syncManager.keyStorePath, e);
        }
    }
View Full Code Here

        String path = syncManager.getClusterConfig().getKeyStorePath();
        String pass = syncManager.getClusterConfig().getKeyStorePassword();
        try {
            return CryptoUtil.getSharedSecret(path, pass);
        } catch (Exception e) {
            throw new AuthException("Could not read challenge/response " +
                    "shared secret from key store " + path, e);
        }
    }
View Full Code Here

    protected byte[] getSharedSecret() throws AuthException {
        try {
            return CryptoUtil.getSharedSecret(bootstrap.keyStorePath,
                                              bootstrap.keyStorePassword);
        } catch (Exception e) {
            throw new AuthException("Could not read challenge/response " +
                    "shared secret from key store " +
                    bootstrap.keyStorePath, e);
        }
    }}
View Full Code Here

TOP

Related Classes of org.sdnplatform.sync.error.AuthException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.