public static void addSRPExtension(Hashtable extensions, byte[] identity) throws IOException { extensions.put(EXT_SRP, createSRPExtension(identity)); }
public void processClientExtensions(Hashtable clientExtensions) throws IOException { super.processClientExtensions(clientExtensions); this.srpIdentity = TlsSRPUtils.getSRPExtension(clientExtensions); }
public static byte[] getSRPExtension(Hashtable extensions) throws IOException { byte[] extensionData = TlsUtils.getExtensionData(extensions, EXT_SRP); return extensionData == null ? null : readSRPExtension(extensionData); }
/** * Encode this {@link ServerSRPParams} to an {@link OutputStream}. * * @param output * the {@link OutputStream} to encode to. * @throws IOException */ public void encode(OutputStream output) throws IOException { TlsSRPUtils.writeSRPParameter(N, output); TlsSRPUtils.writeSRPParameter(g, output); TlsUtils.writeOpaque8(s, output); TlsSRPUtils.writeSRPParameter(B, output); }
/** * Parse a {@link ServerSRPParams} from an {@link InputStream}. * * @param input * the {@link InputStream} to parse from. * @return a {@link ServerSRPParams} object. * @throws IOException */ public static ServerSRPParams parse(InputStream input) throws IOException { BigInteger N = TlsSRPUtils.readSRPParameter(input); BigInteger g = TlsSRPUtils.readSRPParameter(input); byte[] s = TlsUtils.readOpaque8(input); BigInteger B = TlsSRPUtils.readSRPParameter(input); return new ServerSRPParams(N, g, s, B); } }
public Hashtable getClientExtensions() throws IOException { Hashtable clientExtensions = TlsExtensionsUtils.ensureExtensionsInitialised(super.getClientExtensions()); TlsSRPUtils.addSRPExtension(clientExtensions, this.identity); return clientExtensions; }
public int getSelectedCipherSuite() throws IOException { int cipherSuite = super.getSelectedCipherSuite(); if (TlsSRPUtils.isSRPCipherSuite(cipherSuite)) { if (srpIdentity != null) { this.loginParameters = srpIdentityManager.getLoginParameters(srpIdentity); } if (loginParameters == null) { throw new TlsFatalAlert(AlertDescription.unknown_psk_identity); } } return cipherSuite; }
/** * Encode this {@link ServerSRPParams} to an {@link OutputStream}. * * @param output * the {@link OutputStream} to encode to. * @throws IOException */ public void encode(OutputStream output) throws IOException { TlsSRPUtils.writeSRPParameter(N, output); TlsSRPUtils.writeSRPParameter(g, output); TlsUtils.writeOpaque8(s, output); TlsSRPUtils.writeSRPParameter(B, output); }
/** * Parse a {@link ServerSRPParams} from an {@link InputStream}. * * @param input * the {@link InputStream} to parse from. * @return a {@link ServerSRPParams} object. * @throws IOException */ public static ServerSRPParams parse(InputStream input) throws IOException { BigInteger N = TlsSRPUtils.readSRPParameter(input); BigInteger g = TlsSRPUtils.readSRPParameter(input); byte[] s = TlsUtils.readOpaque8(input); BigInteger B = TlsSRPUtils.readSRPParameter(input); return new ServerSRPParams(N, g, s, B); } }
public Hashtable getClientExtensions() throws IOException { Hashtable clientExtensions = TlsExtensionsUtils.ensureExtensionsInitialised(super.getClientExtensions()); TlsSRPUtils.addSRPExtension(clientExtensions, this.identity); return clientExtensions; }
public int getSelectedCipherSuite() throws IOException { int cipherSuite = super.getSelectedCipherSuite(); if (TlsSRPUtils.isSRPCipherSuite(cipherSuite)) { if (srpIdentity != null) { this.loginParameters = srpIdentityManager.getLoginParameters(srpIdentity); } if (loginParameters == null) { throw new TlsFatalAlert(AlertDescription.unknown_psk_identity); } } return cipherSuite; }
public void generateClientKeyExchange(OutputStream output) throws IOException { BigInteger A = srpClient.generateClientCredentials(srpSalt, identity, password); TlsSRPUtils.writeSRPParameter(A, output); context.getSecurityParameters().srpIdentity = Arrays.clone(identity); }
public void processClientKeyExchange(InputStream input) throws IOException { /* * RFC 5054 2.5.4: The server MUST abort the handshake with an "illegal_parameter" alert if * A % N = 0. */ try { this.srpPeerCredentials = SRP6Util.validatePublicValue(srpGroup.getN(), TlsSRPUtils.readSRPParameter(input)); } catch (CryptoException e) { throw new TlsFatalAlert(AlertDescription.illegal_parameter, e); } context.getSecurityParameters().srpIdentity = Arrays.clone(identity); }
public void processClientExtensions(Hashtable clientExtensions) throws IOException { super.processClientExtensions(clientExtensions); this.srpIdentity = TlsSRPUtils.getSRPExtension(clientExtensions); }
public static byte[] getSRPExtension(Hashtable extensions) throws IOException { byte[] extensionData = TlsUtils.getExtensionData(extensions, EXT_SRP); return extensionData == null ? null : readSRPExtension(extensionData); }
public static void addSRPExtension(Hashtable extensions, byte[] identity) throws IOException { extensions.put(EXT_SRP, createSRPExtension(identity)); }
public void generateClientKeyExchange(OutputStream output) throws IOException { BigInteger A = srpClient.generateClientCredentials(srpSalt, identity, password); TlsSRPUtils.writeSRPParameter(A, output); context.getSecurityParameters().srpIdentity = Arrays.clone(identity); }
public void processClientKeyExchange(InputStream input) throws IOException { /* * RFC 5054 2.5.4: The server MUST abort the handshake with an "illegal_parameter" alert if * A % N = 0. */ try { this.srpPeerCredentials = SRP6Util.validatePublicValue(srpGroup.getN(), TlsSRPUtils.readSRPParameter(input)); } catch (CryptoException e) { throw new TlsFatalAlert(AlertDescription.illegal_parameter, e); } context.getSecurityParameters().srpIdentity = Arrays.clone(identity); }