public class BasicBlobCrypter extends Object implements BlobCrypter
| Modifier and Type | Field and Description |
|---|---|
static int |
MASTER_KEY_MIN_LEN
minimum length of master key
|
TimeSource |
timeSource |
| Constructor and Description |
|---|
BasicBlobCrypter(byte[] masterKey)
Builds a BlobCrypter from the specified master key
|
BasicBlobCrypter(byte[] masterKey,
HMACType hmacType) |
BasicBlobCrypter(File keyfile)
Creates a crypter based on a key in a file.
|
BasicBlobCrypter(File keyfile,
HMACType hmacType) |
BasicBlobCrypter(String masterKey)
Builds a BlobCrypter from the specified master key
|
BasicBlobCrypter(String masterKey,
HMACType hmacType) |
| Modifier and Type | Method and Description |
|---|---|
HMACType |
getHmacType() |
void |
setHmacType(HMACType hmacType) |
static void |
setpreferredHMACAlgorithm(String preferredHMACAlgorithm) |
Map<String,String> |
unwrap(String in)
Unwraps a blob.
|
String |
wrap(Map<String,String> in)
Encrypts and signs a blob.
|
public static final int MASTER_KEY_MIN_LEN
public TimeSource timeSource
public BasicBlobCrypter(File keyfile) throws IOException
dd if=/dev/random bs=32 count=1 | openssl base64 > /tmp/key.txt
IOException - if the file can't be read.public BasicBlobCrypter(File keyfile, HMACType hmacType) throws IOException
IOExceptionpublic BasicBlobCrypter(byte[] masterKey)
masterKey - public BasicBlobCrypter(byte[] masterKey,
HMACType hmacType)
public BasicBlobCrypter(String masterKey)
masterKey - @Inject(optional=true) public static void setpreferredHMACAlgorithm(String preferredHMACAlgorithm)
public HMACType getHmacType()
public void setHmacType(HMACType hmacType)
public String wrap(Map<String,String> in) throws BlobCrypterException
BlobCrypterwrap in interface BlobCrypterin - name/value pairs to encryptBlobCrypterException - when crypto errors occurpublic Map<String,String> unwrap(String in) throws BlobCrypterException
BlobCrypterunwrap in interface BlobCrypterin - blobBlobCrypterException - if the blob can't be decoded.Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.