public abstract class GSIRequestHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ASYNC_CIPHER_MODE
RSA algorithm, no block chaining mode (not a block-cipher) and PKCS1
padding, which is recommended to be used in conjunction with RSA
|
protected DHBufferHandler |
bufferHandler |
protected String |
challenge |
static int |
CHALLENGE_BYTES |
protected GSICredentialManager |
credentialManager |
static String |
CRYPTO_MODE |
static String |
CRYPTO_MODE_NO_PAD |
protected DHSession |
dhSession |
protected long |
lastRequest |
protected static org.slf4j.Logger |
LOGGER |
static long |
MAX_TIME_SKEW
Maximum request time skew.
|
protected boolean |
noPadding |
static int |
PROTO_PRE_DELEGATION |
static int |
PROTO_WITH_DELEGATION |
static String |
PROTOCOL |
static int |
PROTOCOL_VERSION |
static String |
PUBLIC_KEY_ALGORITHM
For use in encoding/decoding X509 public keys.
|
static String |
PUBLIC_KEY_FOOTER |
static String |
PUBLIC_KEY_HEADER |
protected static SecureRandom |
RANDOM |
protected RSASession |
rsaSession |
static String |
SESSION_IV_DELIM
Random session IV.
|
static int |
SESSION_IV_LEN |
static String |
SUPPORTED_CIPHER_ALGORITHM
we limit ourselves to AES-128 with CBC blockmode.
|
static String |
SUPPORTED_DIGESTS |
static int |
SYNC_CIPHER_BLOCKSIZE
Blocksize in bytes
|
static String |
SYNC_CIPHER_MODE_PADDED
Sync cipher mode supported by the server.
|
static String |
SYNC_CIPHER_MODE_UNPADDED |
static String |
SYNC_CIPHER_NAME |
| Modifier | Constructor and Description |
|---|---|
protected |
GSIRequestHandler(GSICredentialManager credentialManager) |
| Modifier and Type | Method and Description |
|---|---|
protected NestedBucketBuffer |
decryptMainBucketWithSessionKey(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> receivedBuckets,
String step)
Assumes the dhSession has been finalized.
|
protected byte[] |
dhParams(boolean sign) |
protected X509Certificate[] |
extractChain(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> nestedBuckets)
Pull out the string content of the kXRS_x509 bucket and convert it
into a cert chain.
|
protected void |
finalizeSessionKey(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> receivedBuckets,
XrootdSecurityProtocol.BucketType bucketType)
For the pre-4.9 protocol, the DH client params are sent in the clear
(unsigned) in the kXRS_puk bucket.
|
protected static int |
findSessionIVLen(String cipher) |
static String |
generateChallengeString()
Generate a new challenge string to be used in server-client
communication
|
abstract int |
getProtocolVersion() |
protected abstract String |
getSyncCipherMode() |
protected boolean |
isRequestExpired() |
protected XrootdBucket |
postProcessMainBucket(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> buckets,
Optional<String> serializedX509,
int step)
Generate a new challenge string.
|
protected X509Certificate[] |
processRSAVerification(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> nestedBuckets,
Optional<PublicKey> toMatch) |
protected void |
updateLastRequest() |
protected String |
validateCiphers(String[] algorithms) |
protected void |
validateCryptoMode(String cryptoMode) |
protected String |
validateDigests(String[] digests) |
protected void |
verifySignedRTag(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> nestedBuckets)
From the main bucket extract the challenge tag signed by the sender.
|
protected static org.slf4j.Logger LOGGER
public static final String PROTOCOL
public static final int PROTO_WITH_DELEGATION
public static final int PROTO_PRE_DELEGATION
public static final int PROTOCOL_VERSION
public static final String CRYPTO_MODE
public static final String CRYPTO_MODE_NO_PAD
public static final String SUPPORTED_CIPHER_ALGORITHM
public static final String SUPPORTED_DIGESTS
public static final String ASYNC_CIPHER_MODE
public static final String SYNC_CIPHER_MODE_PADDED
public static final String SYNC_CIPHER_MODE_UNPADDED
public static final String SYNC_CIPHER_NAME
public static final String PUBLIC_KEY_ALGORITHM
public static final String PUBLIC_KEY_HEADER
public static final String PUBLIC_KEY_FOOTER
public static final int SYNC_CIPHER_BLOCKSIZE
public static final int CHALLENGE_BYTES
public static final long MAX_TIME_SKEW
public static final String SESSION_IV_DELIM
public static final int SESSION_IV_LEN
protected static final SecureRandom RANDOM
protected final GSICredentialManager credentialManager
protected DHSession dhSession
protected RSASession rsaSession
protected DHBufferHandler bufferHandler
protected String challenge
protected long lastRequest
protected boolean noPadding
protected GSIRequestHandler(GSICredentialManager credentialManager)
protected static int findSessionIVLen(String cipher) throws XrootdException
XrootdExceptionpublic static String generateChallengeString()
public abstract int getProtocolVersion()
protected abstract String getSyncCipherMode()
protected NestedBucketBuffer decryptMainBucketWithSessionKey(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> receivedBuckets, String step) throws NoSuchPaddingException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, NoSuchProviderException, InvalidKeyException, IOException, XrootdException
receivedBuckets - from the requestNoSuchPaddingExceptionInvalidAlgorithmParameterExceptionNoSuchAlgorithmExceptionIllegalBlockSizeExceptionBadPaddingExceptionNoSuchProviderExceptionInvalidKeyExceptionIOExceptionXrootdExceptionprotected byte[] dhParams(boolean sign)
throws IOException,
BadPaddingException,
IllegalBlockSizeException
sign - if true, use the rsaCipher (assumed to be initialized with
local private key) to sign the params.IOExceptionBadPaddingExceptionIllegalBlockSizeExceptionprotected X509Certificate[] extractChain(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> nestedBuckets) throws XrootdException, IOException
nestedBuckets - containing the x509 bucket.XrootdExceptionIOExceptionprotected void finalizeSessionKey(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> receivedBuckets, XrootdSecurityProtocol.BucketType bucketType) throws IOException, GeneralSecurityException, XrootdException
receivedBuckets - bucketType - kXRS_cipher or kXRS_puk.IOExceptionGeneralSecurityExceptionXrootdExceptionprotected boolean isRequestExpired()
protected XrootdBucket postProcessMainBucket(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> buckets, Optional<String> serializedX509, int step) throws BadPaddingException, IllegalBlockSizeException, NoSuchProviderException, NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, InvalidAlgorithmParameterException, XrootdException, IOException
BadPaddingExceptionIllegalBlockSizeExceptionNoSuchProviderExceptionNoSuchPaddingExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionInvalidAlgorithmParameterExceptionXrootdExceptionIOExceptionprotected X509Certificate[] processRSAVerification(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> nestedBuckets, Optional<PublicKey> toMatch) throws InvalidKeyException, IOException, XrootdException
nestedBuckets - containing the x509 certificate buckettoMatch - if a sender public key has already been extracted.InvalidKeyExceptionIOExceptionXrootdExceptionprotected void updateLastRequest()
protected String validateCiphers(String[] algorithms) throws XrootdException
XrootdExceptionprotected void validateCryptoMode(String cryptoMode) throws XrootdException
XrootdExceptionprotected String validateDigests(String[] digests) throws XrootdException
XrootdExceptionprotected void verifySignedRTag(Map<XrootdSecurityProtocol.BucketType,XrootdBucket> nestedBuckets) throws XrootdException, BadPaddingException, IllegalBlockSizeException, IOException
Copyright © 2011-2020 dCache.org. All Rights Reserved.