For the latest news and information visit
The GNU Crypto project

gnu.crypto.key.srp6
Class SRPPublicKey

java.lang.Object
  extended bygnu.crypto.key.srp6.SRPKey
      extended bygnu.crypto.key.srp6.SRPPublicKey
All Implemented Interfaces:
java.security.Key, java.security.PublicKey, java.io.Serializable

public class SRPPublicKey
extends SRPKey
implements java.security.PublicKey

A representation of an SRP ephemeral public key.

Reference:

  1. SRP Protocol Design
    Thomas J. Wu.

Version:
$Revision: 1.2 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gnu.crypto.key.srp6.SRPKey
g, N
 
Fields inherited from interface java.security.PublicKey
serialVersionUID
 
Constructor Summary
(package private) SRPPublicKey(java.math.BigInteger[] params)
          Default constructor.
  SRPPublicKey(java.math.BigInteger N, java.math.BigInteger g, java.math.BigInteger Y)
          Public constructor for use from outside this package.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the designated object is an instance of SRPPublicKeyand has the same SRP parameter values as this one.
 byte[] getEncoded(int format)
          Returns the encoded form of this public key according to the designated format.
 java.math.BigInteger getY()
          Returns the public exponent of the key as a BigInteger.
static SRPPublicKey valueOf(byte[] k)
          A class method that takes the output of the encodePublicKey() method of an SRP keypair codec object (an instance implementing IKeyPairCodec for SRP keys, and re-constructs an instance of this object.
 
Methods inherited from class gnu.crypto.key.srp6.SRPKey
getAlgorithm, getEncoded, getFormat, getG, getN
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Key
getAlgorithm, getEncoded, getFormat
 

Constructor Detail

SRPPublicKey

public SRPPublicKey(java.math.BigInteger N,
                    java.math.BigInteger g,
                    java.math.BigInteger Y)

Public constructor for use from outside this package.

Parameters:
N - the public shared modulus.
g - the generator.
Y - the public exponent of the ephemeral key.

SRPPublicKey

SRPPublicKey(java.math.BigInteger[] params)

Default constructor. Assumes that N and g are already validated.

Parameters:
params - an array of 3 values representing N, g and Y; the latter being the client's or server's public exponent.
Method Detail

valueOf

public static SRPPublicKey valueOf(byte[] k)

A class method that takes the output of the encodePublicKey() method of an SRP keypair codec object (an instance implementing IKeyPairCodec for SRP keys, and re-constructs an instance of this object.

Parameters:
k - the contents of a previously encoded instance of this object.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if there is not enough bytes, in k, to represent a valid encoding of an instance of this object.
java.lang.IllegalArgumentException - if the byte sequence does not represent a valid encoding of an instance of this object.

getY

public java.math.BigInteger getY()

Returns the public exponent of the key as a BigInteger.

Returns:
the public exponent of the key as a BigInteger.

getEncoded

public byte[] getEncoded(int format)

Returns the encoded form of this public key according to the designated format.

Specified by:
getEncoded in class SRPKey
Parameters:
format - the desired format identifier of the resulting encoding.
Returns:
the byte sequence encoding this key according to the designated format.
Throws:
java.lang.IllegalArgumentException - if the format is not supported.

equals

public boolean equals(java.lang.Object obj)

Returns true if the designated object is an instance of SRPPublicKeyand has the same SRP parameter values as this one.

Overrides:
equals in class SRPKey
Parameters:
obj - the other non-null SRP key to compare to.
Returns:
true if the designated object is of the same type and value as this one.

For the latest news and information visit
The GNU Crypto project

Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.