Class RSASession
- java.lang.Object
-
- org.dcache.xrootd.plugins.authn.gsi.RSASession
-
public class RSASession extends java.lang.ObjectThis class is necessitated by the fact that the new GSI protocol requires encryption and decryption of the arbitrarily long Diffie-Hellman encoded parameters. RSA encryption/decryption is not recommended for block-like processing of messages, but this is the way that the SLAC client and server do it, so we are constrained to follow suit.
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.crypto.Ciphercipherprotected static org.slf4j.LoggerLOGGERprotected intmaxDecryptionBlockSizeprotected intmaxEncryptionBlockSize
-
Constructor Summary
Constructors Constructor Description RSASession()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]decrypt(byte[] in)byte[]encrypt(byte[] in)voidinitializeForDecryption(java.security.PublicKey publicKey)Prepare rsaCipher for decryption using received public key.voidinitializeForEncryption(java.security.PrivateKey privateKey)Prepare rsaCipher for encryption using local private key.
-
-
-
Method Detail
-
initializeForEncryption
public void initializeForEncryption(java.security.PrivateKey privateKey) throws javax.crypto.NoSuchPaddingException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.InvalidKeyExceptionPrepare rsaCipher for encryption using local private key.- Throws:
javax.crypto.NoSuchPaddingExceptionjava.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionjava.security.InvalidKeyException
-
initializeForDecryption
public void initializeForDecryption(java.security.PublicKey publicKey) throws javax.crypto.NoSuchPaddingException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.InvalidKeyExceptionPrepare rsaCipher for decryption using received public key.- Throws:
javax.crypto.NoSuchPaddingExceptionjava.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionjava.security.InvalidKeyException
-
encrypt
public byte[] encrypt(byte[] in) throws java.io.IOException, javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException- Throws:
java.io.IOExceptionjavax.crypto.BadPaddingExceptionjavax.crypto.IllegalBlockSizeException
-
decrypt
public byte[] decrypt(byte[] in) throws java.io.IOException, javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException- Throws:
java.io.IOExceptionjavax.crypto.BadPaddingExceptionjavax.crypto.IllegalBlockSizeException
-
-