crypto tuning

This commit is contained in:
Adrian Cole 2011-04-04 23:37:00 -07:00
parent d69d31a5d2
commit b9f0cbcb89
2 changed files with 4 additions and 5 deletions

View File

@ -25,7 +25,6 @@ import static org.jclouds.io.Payloads.newPayload;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.security.MessageDigest;
import java.util.Map; import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
@ -128,12 +127,12 @@ public class BlobBuilderImpl implements BlobBuilder {
public class PayloadBlobBuilderImpl implements PayloadBlobBuilder { public class PayloadBlobBuilderImpl implements PayloadBlobBuilder {
private final BlobBuilder builder; private final BlobBuilder builder;
private final Payload payload; private final Payload payload;
private MessageDigest digest; private final Crypto crypto;
public PayloadBlobBuilderImpl(BlobBuilder builder, Payload payload, Crypto crypto) { public PayloadBlobBuilderImpl(BlobBuilder builder, Payload payload, Crypto crypto) {
this.builder = checkNotNull(builder, "builder"); this.builder = checkNotNull(builder, "builder");
this.payload = checkNotNull(payload, "payload"); this.payload = checkNotNull(payload, "payload");
this.digest = checkNotNull(crypto, "crypto").md5(); this.crypto = checkNotNull(crypto, "crypto");
} }
@Override @Override
@ -158,7 +157,7 @@ public class BlobBuilderImpl implements BlobBuilder {
@Override @Override
public PayloadBlobBuilder calculateMD5() throws IOException { public PayloadBlobBuilder calculateMD5() throws IOException {
return builder.payload(Payloads.calculateMD5(payload, digest)); return builder.payload(Payloads.calculateMD5(payload, crypto.md5()));
} }
@Override @Override

View File

@ -61,7 +61,7 @@
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId> <artifactId>bcprov-jdk16</artifactId>
<version>1.45</version> <version>1.46</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>