public abstract class ProviderCredentials
extends java.lang.Object
Constructor and Description |
---|
ProviderCredentials(java.lang.String accessKey,
java.lang.String secretKey)
Construct credentials.
|
ProviderCredentials(java.lang.String accessKey,
java.lang.String secretKey,
java.lang.String friendlyName)
Construct credentials, and associate them with a human-friendly name.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAccessKey() |
java.lang.String |
getFriendlyName() |
java.lang.String |
getLogString() |
java.lang.String |
getSecretKey() |
boolean |
hasFriendlyName() |
static ProviderCredentials |
load(java.lang.String password,
java.io.BufferedInputStream inputStream)
Loads encrypted credentials from a data input stream.
|
static ProviderCredentials |
load(java.lang.String password,
java.io.File file)
Loads encrypted credentials from a file.
|
void |
save(java.lang.String password,
java.io.File file)
Encrypts ProviderCredentials with the given password and saves the encrypted data to a file
using the default algorithm
EncryptionUtil.DEFAULT_ALGORITHM . |
void |
save(java.lang.String password,
java.io.File file,
java.lang.String algorithm)
Encrypts ProviderCredentials with the given password and saves the encrypted data to a file.
|
void |
save(java.lang.String password,
java.io.OutputStream outputStream)
Encrypts ProviderCredentials with the given password and writes the encrypted data to an
output stream using the default algorithm
EncryptionUtil.DEFAULT_ALGORITHM . |
void |
save(java.lang.String password,
java.io.OutputStream outputStream,
java.lang.String algorithm)
Encrypts ProviderCredentials with the given password and writes the encrypted data to an
output stream.
|
public ProviderCredentials(java.lang.String accessKey, java.lang.String secretKey)
accessKey
- Access key for a storage account.secretKey
- Secret key for a storage account.public ProviderCredentials(java.lang.String accessKey, java.lang.String secretKey, java.lang.String friendlyName)
accessKey
- Access key for a storage account.secretKey
- Secret key for a storage account.friendlyName
- a name identifying the owner of the credentials, such as 'James'.public java.lang.String getAccessKey()
public java.lang.String getSecretKey()
public java.lang.String getFriendlyName()
public boolean hasFriendlyName()
public java.lang.String getLogString()
public void save(java.lang.String password, java.io.File file, java.lang.String algorithm) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.spec.InvalidKeySpecException, java.lang.IllegalStateException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.security.InvalidAlgorithmParameterException, java.io.IOException
password
- the password used to encrypt the credentials.file
- the file to write the encrypted credentials data to.algorithm
- the algorithm used to encrypt the output stream.java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.spec.InvalidKeySpecException
java.lang.IllegalStateException
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException
java.security.InvalidAlgorithmParameterException
java.io.IOException
public void save(java.lang.String password, java.io.File file) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.spec.InvalidKeySpecException, java.lang.IllegalStateException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.security.InvalidAlgorithmParameterException, java.io.IOException
EncryptionUtil.DEFAULT_ALGORITHM
.password
- the password used to encrypt the credentials.file
- the file to write the encrypted credentials data to.java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.spec.InvalidKeySpecException
java.lang.IllegalStateException
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException
java.security.InvalidAlgorithmParameterException
java.io.IOException
public void save(java.lang.String password, java.io.OutputStream outputStream, java.lang.String algorithm) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.spec.InvalidKeySpecException, java.lang.IllegalStateException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.security.InvalidAlgorithmParameterException, java.io.IOException
password
- the password used to encrypt the credentials.outputStream
- the output stream to write the encrypted credentials data to, this stream must be closed by
the caller.algorithm
- the algorithm used to encrypt the output stream.java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.spec.InvalidKeySpecException
java.lang.IllegalStateException
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException
java.security.InvalidAlgorithmParameterException
java.io.IOException
public void save(java.lang.String password, java.io.OutputStream outputStream) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.spec.InvalidKeySpecException, java.lang.IllegalStateException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.security.InvalidAlgorithmParameterException, java.io.IOException
EncryptionUtil.DEFAULT_ALGORITHM
.password
- the password used to encrypt the credentials.outputStream
- the output stream to write the encrypted credentials data to, this stream must be closed by
the caller.java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.spec.InvalidKeySpecException
java.lang.IllegalStateException
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException
java.security.InvalidAlgorithmParameterException
java.io.IOException
public static ProviderCredentials load(java.lang.String password, java.io.File file) throws ServiceException
password
- the password used to decrypt the credentials. If null, the credentials are not decrypted
and only the version and friendly-name information is loaded.file
- a file containing an encrypted data encoding of an ProviderCredentials object.ServiceException
public static ProviderCredentials load(java.lang.String password, java.io.BufferedInputStream inputStream) throws ServiceException
password
- the password used to decrypt the credentials. If null, the credentials are not decrypted
and only the version and friendly-name information is loaded.inputStream
- an input stream containing an encrypted data encoding of an ProviderCredentials object.ServiceException