Class CredentialsUtils


  • public class CredentialsUtils
    extends Object
    An utility class for handling credentials
    Author:
    Daniele Andreotti, Andrea Ceccanti
    • Constructor Detail

      • CredentialsUtils

        public CredentialsUtils()
    • Method Detail

      • saveProxyCredentials

        public static void saveProxyCredentials​(OutputStream os,
                                                eu.emi.security.authn.x509.X509Credential uc,
                                                CredentialsUtils.PrivateKeyEncoding encoding)
                                         throws IOException
        Saves user credentials as a plain text PEM data.
        Writes the user certificate chain first, then the user key.
        Parameters:
        os - the output stream
        uc - the user credential that must be serialized
        encoding - the private key encoding
        Throws:
        IOException - in case of errors writing on the output stream
      • saveProxyCredentials

        public static void saveProxyCredentials​(OutputStream os,
                                                eu.emi.security.authn.x509.X509Credential uc)
                                         throws IOException
        Saves user credentials as a plain text PEM data.
        Writes the user certificate chain first, then the user key, using the default encoding specified in DEFAULT_ENCONDING.
        Parameters:
        os - the output stream for the saved proxy
        uc - the user credential
        Throws:
        IOException - in case of errors writing to the output stream
      • saveProxyCredentials

        public static void saveProxyCredentials​(String proxyFileName,
                                                eu.emi.security.authn.x509.X509Credential uc,
                                                CredentialsUtils.PrivateKeyEncoding encoding)
                                         throws IOException
        Saves proxy credentials to a file. This method ensures that the stored proxy is saved with the appropriate file permissions.
        Parameters:
        proxyFileName - the file where the proxy will be saved
        uc - the credential to be saved
        encoding - the private key encoding
        Throws:
        IOException - in case of errors writing to the proxy file
      • saveProxyCredentials

        public static void saveProxyCredentials​(String proxyFileName,
                                                eu.emi.security.authn.x509.X509Credential uc)
                                         throws IOException
        Saves proxy credentials to a file. This method ensures that the stored proxy is saved with the appropriate file permissions, using the default encoding specified in DEFAULT_ENCONDING.
        Parameters:
        proxyFileName - the file where the proxy will be saved
        uc - the credential to be saved
        Throws:
        IOException - in case of errors writing the credential to the proxy file