|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openid4java.association.DiffieHellmanSession
public class DiffieHellmanSession
Field Summary | |
---|---|
static java.lang.String |
ALGORITHM
|
static long |
DEFAULT_GENERATOR
|
static java.lang.String |
DEFAULT_GENERATOR_BASE64
|
static java.lang.String |
DEFAULT_MODULUS_BASE64
|
static java.lang.String |
DEFAULT_MODULUS_HEX
|
static java.lang.String |
H_ALGORITHM_SHA1
|
static java.lang.String |
H_ALGORITHM_SHA256
|
Method Summary | |
---|---|
static DiffieHellmanSession |
create(AssociationSessionType type,
javax.crypto.spec.DHParameterSpec dhParameterSpec)
|
static DiffieHellmanSession |
create(AssociationSessionType type,
java.lang.String modulusBase64,
java.lang.String generatorBase64)
|
byte[] |
decryptMacKey(java.lang.String encMacKeyBase64,
java.lang.String serverPublicKeyBase64)
Decrypts the association AMC key. |
java.lang.String |
encryptMacKey(byte[] macKey,
java.lang.String consumerPublicKeyBase64)
Encrypts the association MAC key. |
protected static java.security.KeyPair |
generateKeyPair(javax.crypto.spec.DHParameterSpec dhSpec)
|
static javax.crypto.spec.DHParameterSpec |
generateRandomParameter(int primeSize,
int keySize)
|
static javax.crypto.spec.DHParameterSpec |
getDefaultParameter()
|
protected byte[] |
getDigestedZZ(java.lang.String otherPublicKeyBase64)
|
java.lang.String |
getGenerator()
Gets the generator for the Diffie-Hellman key echange. |
java.lang.String |
getModulus()
Gets the modulus for the Diffie-Hellman key echange. |
protected javax.crypto.interfaces.DHPrivateKey |
getPrivateKey()
|
java.lang.String |
getPublicKey()
Get the Diffie-Hellman public key. |
AssociationSessionType |
getType()
|
static boolean |
isDhSha1Supported()
|
static boolean |
isDhSha256Supported()
|
static boolean |
isDhShaSupported(java.lang.String shaAlgorithm)
|
static boolean |
isDhSupported(AssociationSessionType type)
|
protected static java.lang.String |
publicKeyToString(javax.crypto.interfaces.DHPublicKey publicKey)
|
protected javax.crypto.interfaces.DHPublicKey |
stringToPublicKey(java.lang.String publicKeyBase64)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_MODULUS_HEX
public static final java.lang.String DEFAULT_MODULUS_BASE64
public static final long DEFAULT_GENERATOR
public static final java.lang.String DEFAULT_GENERATOR_BASE64
public static final java.lang.String ALGORITHM
public static final java.lang.String H_ALGORITHM_SHA1
public static final java.lang.String H_ALGORITHM_SHA256
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public static DiffieHellmanSession create(AssociationSessionType type, java.lang.String modulusBase64, java.lang.String generatorBase64) throws AssociationException
AssociationException
public static DiffieHellmanSession create(AssociationSessionType type, javax.crypto.spec.DHParameterSpec dhParameterSpec) throws AssociationException
AssociationException
public static javax.crypto.spec.DHParameterSpec getDefaultParameter()
public static javax.crypto.spec.DHParameterSpec generateRandomParameter(int primeSize, int keySize)
protected static java.security.KeyPair generateKeyPair(javax.crypto.spec.DHParameterSpec dhSpec)
public AssociationSessionType getType()
public java.lang.String getModulus()
base64(btwoc(p))
public java.lang.String getGenerator()
base64(btwoc(g))
public java.lang.String getPublicKey()
base64(btwoc(g ^ x mod p))
protected javax.crypto.interfaces.DHPrivateKey getPrivateKey()
public java.lang.String encryptMacKey(byte[] macKey, java.lang.String consumerPublicKeyBase64) throws AssociationException
macKey
- The MAC key in binary format.consumerPublicKeyBase64
- The base 64 encoding of the consumer
Diffie-Hellman public key. This is the
value passed in the
openid.dh_consumer_public
association request parameter.
base64(H(btwoc(g ^ (xa * xb) mod p)) XOR MAC)
AssociationException
- if the lengths of the mac key and digest
of Diffie-Hellman shared secred do not
match.public byte[] decryptMacKey(java.lang.String encMacKeyBase64, java.lang.String serverPublicKeyBase64) throws AssociationException
encMacKeyBase64
- The base 64 encoded two's-complement
representation of the encrypted mac key:
base64(H(btwoc(g ^ (xa * xb) mod p)) XOR MAC)
.
This is the value passed in the
openid.enc_mac_key association
response parameter.serverPublicKeyBase64
- The base 64 encoding of the server
Diffie-Hellman public key. This is the
value passed in the
openid.dh_server_public
association response parameter.
AssociationException
- if the lengths of the encrypted mac key
and digest of Diffie-Hellman shared
secret do not match.protected static java.lang.String publicKeyToString(javax.crypto.interfaces.DHPublicKey publicKey)
protected javax.crypto.interfaces.DHPublicKey stringToPublicKey(java.lang.String publicKeyBase64)
protected byte[] getDigestedZZ(java.lang.String otherPublicKeyBase64)
public static boolean isDhSupported(AssociationSessionType type)
public static boolean isDhShaSupported(java.lang.String shaAlgorithm)
public static boolean isDhSha1Supported()
public static boolean isDhSha256Supported()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |