public class CredentialsUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CredentialsUtils.PrivateKeyEncoding
The encoding used to serialize proxy credentials private key.
|
Modifier and Type | Field and Description |
---|---|
static CredentialsUtils.PrivateKeyEncoding |
DEFAULT_ENCONDING
The default encoding used when no encoding is specified by callers.
|
Constructor and Description |
---|
CredentialsUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
savePrivateKey(java.io.OutputStream os,
java.security.PrivateKey key,
CredentialsUtils.PrivateKeyEncoding encoding)
Serializes a private key to an output stream according to an encoding.
|
private static void |
savePrivateKeyPKCS1(java.io.OutputStream os,
java.security.PrivateKey key)
Serializes a private key to an output stream following the pkcs1 encoding.
|
private static void |
savePrivateKeyPKCS8(java.io.OutputStream os,
java.security.PrivateKey key)
Serializes a private key to an output stream following the pkcs8 encoding.
|
static void |
saveProxyCredentials(java.io.OutputStream os,
eu.emi.security.authn.x509.X509Credential uc)
Saves user credentials as a plain text PEM data.
|
static void |
saveProxyCredentials(java.io.OutputStream os,
eu.emi.security.authn.x509.X509Credential uc,
CredentialsUtils.PrivateKeyEncoding encoding)
Saves user credentials as a plain text PEM data.
|
static void |
saveProxyCredentials(java.lang.String proxyFileName,
eu.emi.security.authn.x509.X509Credential uc)
Saves proxy credentials to a file.
|
static void |
saveProxyCredentials(java.lang.String proxyFileName,
eu.emi.security.authn.x509.X509Credential uc,
CredentialsUtils.PrivateKeyEncoding encoding)
Saves proxy credentials to a file.
|
public static final CredentialsUtils.PrivateKeyEncoding DEFAULT_ENCONDING
public static void savePrivateKey(java.io.OutputStream os, java.security.PrivateKey key, CredentialsUtils.PrivateKeyEncoding encoding) throws java.io.IOException
os
- the target output streamkey
- the key to be serializedencoding
- the encodingjava.lang.IllegalArgumentException
- for unsupported private key encodingsjava.io.IOException
- if write fails for any reason on the output streamprivate static void savePrivateKeyPKCS8(java.io.OutputStream os, java.security.PrivateKey key) throws java.lang.IllegalArgumentException, java.io.IOException
os
- key
- java.lang.IllegalArgumentException
java.io.IOException
private static void savePrivateKeyPKCS1(java.io.OutputStream os, java.security.PrivateKey key) throws java.lang.IllegalArgumentException, java.io.IOException
os
- key
- java.lang.IllegalArgumentException
java.io.IOException
public static void saveProxyCredentials(java.io.OutputStream os, eu.emi.security.authn.x509.X509Credential uc, CredentialsUtils.PrivateKeyEncoding encoding) throws java.io.IOException
os
- the output streamuc
- the user credential that must be serializedencoding
- the private key encodingjava.io.IOException
- in case of errors writing on the output streampublic static void saveProxyCredentials(java.io.OutputStream os, eu.emi.security.authn.x509.X509Credential uc) throws java.io.IOException
DEFAULT_ENCONDING
.os
- the output stream for the saved proxyuc
- the user credentialjava.io.IOException
- in case of errors writing to the output streampublic static void saveProxyCredentials(java.lang.String proxyFileName, eu.emi.security.authn.x509.X509Credential uc, CredentialsUtils.PrivateKeyEncoding encoding) throws java.io.IOException
proxyFileName
- the file where the proxy will be saveduc
- the credential to be savedencoding
- the private key encodingjava.io.IOException
- in case of errors writing to the proxy filepublic static void saveProxyCredentials(java.lang.String proxyFileName, eu.emi.security.authn.x509.X509Credential uc) throws java.io.IOException
DEFAULT_ENCONDING
.proxyFileName
- the file where the proxy will be saveduc
- the credential to be savedjava.io.IOException
- in case of errors writing the credential to the proxy file