Top Description Fields Constructors Methods
org.bouncycastle.est

public Class HttpAuth

extends Object
implements ESTAuth
Class Inheritance
All Implemented Interfaces
org.bouncycastle.est.ESTAuth
Imports
java.io.ByteArrayInputStream, .IOException, .OutputStream, java.security.SecureRandom, java.util.ArrayList, .Collections, .HashMap, .HashSet, .Iterator, .List, .Map, .Set, org.bouncycastle.asn1.nist.NISTObjectIdentifiers, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.operator.DefaultDigestAlgorithmIdentifierFinder, .DigestAlgorithmIdentifierFinder, .DigestCalculator, .DigestCalculatorProvider, .OperatorCreationException, org.bouncycastle.util.Arrays, .Strings, org.bouncycastle.util.encoders.Base64, .Hex

Provides stock implementations for basic auth and digest auth.

Field Summary

Modifier and TypeField and Description
private static final DigestAlgorithmIdentifierFinder
private final DigestCalculatorProvider
private final SecureRandom
private final char[]
private final String
private final String
private static final Set<String>

Constructor Summary

AccessConstructor and Description
public
HttpAuth(String
user id.
username
,
char[]
user's password.
password
)

Base constructor for basic auth.

public
HttpAuth(String
expected server realm.
realm
,
String
user id.
username
,
char[]
user's password.
password
)

Constructor for basic auth with a specified realm.

public
HttpAuth(String
user id.
username
,
char[]
user's password.
password
,
SecureRandom
random source for generating nonces.
nonceGenerator
,
DigestCalculatorProvider
provider for digest calculators needed for calculating hashes.
digestCalculatorProvider
)

Base constructor for digest auth.

public
HttpAuth(String
expected server realm.
realm
,
String
user id.
username
,
char[]
user's password.
password
,
SecureRandom
random source for generating nonces.
nonceGenerator
,
DigestCalculatorProvider
provider for digest calculators needed for calculating hashes.
digestCalculatorProvider
)

Constructor for digest auth with a specified realm.

Method Summary

Modifier and TypeMethod and Description
public void
applyAuth(final ESTRequestBuilder
the builder for the request needing the Auth attributes.
reqBldr
)

Implements org.bouncycastle.est.ESTAuth.applyAuth.

Add the Auth attributes to the passed in request builder.

private ESTResponse
private DigestCalculator
private AlgorithmIdentifier
lookupDigest(String algorithm)

private String
makeNonce(int len)

private void
update(OutputStream dOut, char[] value)

private void
update(OutputStream dOut, String value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

digestAlgorithmIdentifierFinderback to summary
private static final DigestAlgorithmIdentifierFinder digestAlgorithmIdentifierFinder
digestCalculatorProviderback to summary
private final DigestCalculatorProvider digestCalculatorProvider
nonceGeneratorback to summary
private final SecureRandom nonceGenerator
passwordback to summary
private final char[] password
realmback to summary
private final String realm
usernameback to summary
private final String username
validPartsback to summary
private static final Set<String> validParts

Constructor Detail

HttpAuthback to summary
public HttpAuth(String username, char[] password)

Base constructor for basic auth.

Parameters
username:String

user id.

password:char[]

user's password.

HttpAuthback to summary
public HttpAuth(String realm, String username, char[] password)

Constructor for basic auth with a specified realm.

Parameters
realm:String

expected server realm.

username:String

user id.

password:char[]

user's password.

HttpAuthback to summary
public HttpAuth(String username, char[] password, SecureRandom nonceGenerator, DigestCalculatorProvider digestCalculatorProvider)

Base constructor for digest auth. The realm will be set by

Parameters
username:String

user id.

password:char[]

user's password.

nonceGenerator:SecureRandom

random source for generating nonces.

digestCalculatorProvider:DigestCalculatorProvider

provider for digest calculators needed for calculating hashes.

HttpAuthback to summary
public HttpAuth(String realm, String username, char[] password, SecureRandom nonceGenerator, DigestCalculatorProvider digestCalculatorProvider)

Constructor for digest auth with a specified realm.

Parameters
realm:String

expected server realm.

username:String

user id.

password:char[]

user's password.

nonceGenerator:SecureRandom

random source for generating nonces.

digestCalculatorProvider:DigestCalculatorProvider

provider for digest calculators needed for calculating hashes.

Method Detail

applyAuthback to summary
public void applyAuth(final ESTRequestBuilder reqBldr)

Implements org.bouncycastle.est.ESTAuth.applyAuth.

Doc from org.bouncycastle.est.ESTAuth.applyAuth.

Add the Auth attributes to the passed in request builder.

Parameters
reqBldr:ESTRequestBuilder

the builder for the request needing the Auth attributes.

doDigestFunctionback to summary
private ESTResponse doDigestFunction(ESTResponse res) throws IOException
getDigestCalculatorback to summary
private DigestCalculator getDigestCalculator(String algorithm, AlgorithmIdentifier digestAlg) throws IOException
lookupDigestback to summary
private AlgorithmIdentifier lookupDigest(String algorithm)
makeNonceback to summary
private String makeNonce(int len)
updateback to summary
private void update(OutputStream dOut, char[] value) throws IOException
updateback to summary
private void update(OutputStream dOut, String value) throws IOException