net.java.truelicense.core.BasicV2LicenseManagementContext Maven / Gradle / Ivy
Show all versions of truelicense-core Show documentation
/*
* Copyright (C) 2005-2013 Schlichtherle IT Services.
* All rights reserved. Use is subject to license terms.
*/
package net.java.truelicense.core;
import javax.annotation.concurrent.Immutable;
import net.java.truelicense.core.auth.BasicRepository;
import net.java.truelicense.core.crypto.*;
import net.java.truelicense.core.io.Transformation;
import net.java.truelicense.obfuscate.Obfuscate;
/**
* The root context for the management of V2 format license keys.
*
* @author Christian Schlichtherle
*/
@Immutable
public abstract class BasicV2LicenseManagementContext
extends BasicLicenseManagementContext {
@Obfuscate
private static final String STORE_TYPE = "JCEKS";
@Obfuscate
private static final String PBE_ALGORITHM = "PBEWithSHA1AndDESede";
protected BasicV2LicenseManagementContext(String subject) { super(subject); }
@Override public License license() { return new License(); }
/**
* {@inheritDoc}
*
* The implementation in the class {@link BasicV2LicenseManagementContext}
* returns {@code "JCEKS"}.
*/
@Override public final String storeType() { return STORE_TYPE; }
/**
* {@inheritDoc}
*
* The implementation in the class {@link BasicV2LicenseManagementContext}
* returns a new {@link BasicRepository}.
*/
@Override public final BasicRepository repository() {
return new BasicRepository();
}
/**
* {@inheritDoc}
*
* The implementation in the class {@link BasicV2LicenseManagementContext}
* returns a compression for V2 format license keys.
*/
@Override public final Transformation compression() {
return new V2Compression();
}
/**
* {@inheritDoc}
*
* The implementation in the class {@link BasicV2LicenseManagementContext}
* returns {@code "PBEWithSHA1AndDESede"}.
*/
@Override public final String pbeAlgorithm() { return PBE_ALGORITHM; }
/**
* {@inheritDoc}
*
* The implementation in the class {@link BasicV2LicenseManagementContext}
* returns an encryption for V2 format license keys with the given
* parameters.
*/
@Override public final Encryption encryption(PbeParameters pbe) {
return new V2Encryption(pbe);
}
}