Top Description Methods
com.ongres.scram.common

public Interface ScramMechanism

Known Direct Implementers
com.ongres.scram.common.ScramMechanisms
Imports
com.ongres.scram.common.stringprep.StringPreparation

Definition of the functionality to be provided by every ScramMechanism. Every ScramMechanism implemented must provide implementations of their respective digest and hmac function that will not throw a RuntimeException on any JVM, to guarantee true portability of this library.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The length (in bits)
algorithmKeyLength
()

Returns the length of the key length of the algorithm.

public byte[]

Returns:

The calculated message digest
digest
(byte[]
the message
message
)

Calculate a message digest, according to the algorithm of the SCRAM mechanism.

public String

Returns:

The mechanism name
getName
()

The name of the mechanism, which must be a value registered under IANA: SASL SCRAM Family Mechanisms

public byte[]

Returns:

The calculated message hmac instance
hmac
(byte[]
the key
key
,
byte[]
the message
message
)

Calculate the hmac of a key and a message, according to the algorithm of the SCRAM mechanism.

public byte[]

Returns:

The salted password
saltedPassword
(StringPreparation stringPreparation, String password, byte[] salt, int iteration)

Compute the salted password

public boolean

Returns:

True if it supports channel binding, false otherwise
supportsChannelBinding
()

Whether this mechanism supports channel binding

Method Detail

algorithmKeyLengthback to summary
public int algorithmKeyLength()

Returns the length of the key length of the algorithm.

Returns:int

The length (in bits)

digestback to summary
public byte[] digest(byte[] message) throws RuntimeException

Calculate a message digest, according to the algorithm of the SCRAM mechanism.

Parameters
message:byte[]

the message

Returns:byte[]

The calculated message digest

Exceptions
RuntimeException:
If the algorithm is not provided by current JVM or any included implementations
getNameback to summary
public String getName()

The name of the mechanism, which must be a value registered under IANA: SASL SCRAM Family Mechanisms

Returns:String

The mechanism name

hmacback to summary
public byte[] hmac(byte[] key, byte[] message) throws RuntimeException

Calculate the hmac of a key and a message, according to the algorithm of the SCRAM mechanism.

Parameters
key:byte[]

the key

message:byte[]

the message

Returns:byte[]

The calculated message hmac instance

Exceptions
RuntimeException:
If the algorithm is not provided by current JVM or any included implementations
saltedPasswordback to summary
public byte[] saltedPassword(StringPreparation stringPreparation, String password, byte[] salt, int iteration)

Compute the salted password

Returns:byte[]

The salted password

supportsChannelBindingback to summary
public boolean supportsChannelBinding()

Whether this mechanism supports channel binding

Returns:boolean

True if it supports channel binding, false otherwise