Skip to content
Snippets Groups Projects
Commit 29f4db66 authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

[cleanup] Remove unneeded code

parent 703f9ba8
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,6 @@
import java.io.IOException;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.security.GeneralSecurityException;
import java.util.Collection;
import java.util.Date;
......@@ -82,8 +81,6 @@ public class RSACryptoScriptService implements ScriptService
*/
public static final String ROLEHINT = "rsa";
private static final Charset UTF8 = Charset.forName("UTF-8");
@Inject
@Named("RSA")
private KeyPairGenerator keyPairGenerator;
......@@ -330,7 +327,7 @@ public CertifiedPublicKey issueCertificate(CertifiedKeyPair issuer, PublicKeyPar
params = new X509CertificateParameters(
extensionBuilder.get().addSubjectAltName(false, subjectAltName.toArray(new X509GeneralName[]{}))
.build());
Set<String> extUsage = new HashSet<String>();
Set<String> extUsage = new HashSet<>();
for (X509GeneralName genName : subjectAltName) {
if (genName instanceof X509Rfc822Name) {
extUsage.add(ExtendedKeyUsages.EMAIL_PROTECTION);
......@@ -410,7 +407,7 @@ public byte[] cmsSign(byte[] data, CertifiedKeyPair keyPair, CertificateProvider
}
}
Set<CertifiedPublicKey> certs = new HashSet<CertifiedPublicKey>();
Set<CertifiedPublicKey> certs = new HashSet<>();
if (existingSignature != null && existingSignature.getCertificates() != null) {
certs.addAll(existingSignature.getCertificates());
}
......
......@@ -19,6 +19,8 @@
*/
package org.xwiki.crypto.script;
import java.nio.charset.StandardCharsets;
import org.xwiki.crypto.pkix.params.CertifiedKeyPair;
import org.xwiki.crypto.pkix.params.CertifiedPublicKey;
import org.xwiki.crypto.script.internal.AbstractScriptingStore;
......@@ -72,7 +74,7 @@ public void store(CertifiedKeyPair keyPair) throws KeyStoreException, AccessDeni
public void store(CertifiedKeyPair keyPair, String password) throws KeyStoreException, AccessDeniedException
{
checkAccess(Right.EDIT);
store.store(storeReference, keyPair, password.getBytes(UTF8));
store.store(storeReference, keyPair, password.getBytes(StandardCharsets.UTF_8));
}
/**
......@@ -100,7 +102,7 @@ public CertifiedKeyPair retrieve() throws KeyStoreException, AccessDeniedExcepti
public CertifiedKeyPair retrieve(String password) throws KeyStoreException, AccessDeniedException
{
checkAccess(Right.VIEW);
return store.retrieve(storeReference, password.getBytes(UTF8));
return store.retrieve(storeReference, password.getBytes(StandardCharsets.UTF_8));
}
/**
......@@ -131,6 +133,6 @@ public CertifiedKeyPair retrieve(CertifiedPublicKey publicKey, String password)
throws KeyStoreException, AccessDeniedException
{
checkAccess(Right.VIEW);
return store.retrieve(storeReference, publicKey, password.getBytes(UTF8));
return store.retrieve(storeReference, publicKey, password.getBytes(StandardCharsets.UTF_8));
}
}
......@@ -19,8 +19,6 @@
*/
package org.xwiki.crypto.script.internal;
import java.nio.charset.Charset;
import org.xwiki.crypto.store.StoreReference;
import org.xwiki.crypto.store.WikiStoreReference;
import org.xwiki.security.authorization.AccessDeniedException;
......@@ -35,8 +33,6 @@
*/
public abstract class AbstractScriptingStore
{
protected static final Charset UTF8 = Charset.forName("UTF-8");
protected StoreReference storeReference;
private ContextualAuthorizationManager contextualAuthorizationManager;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment