本文整理汇总了Java中gnu.classpath.Configuration类的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Configuration类属于gnu.classpath包,在下文中一共展示了Configuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeLibrary
import gnu.classpath.Configuration; //导入依赖的package包/类
/**
* @return <code>true</code> if the GMP-based native implementation library
* was successfully loaded. Returns <code>false</code> otherwise.
*/
private static boolean initializeLibrary()
{
boolean result;
try
{
System.loadLibrary("javamath");
GMP.natInitializeLibrary();
result = true;
}
catch (Throwable x)
{
result = false;
if (Configuration.DEBUG)
{
log.info("Unable to use native BigInteger: " + x);
log.info("Will use a pure Java implementation instead");
}
}
return result;
}
示例2: cos
import gnu.classpath.Configuration; //导入依赖的package包/类
/**
* Helper trig function; computes cos in range [-pi/4, pi/4].
*
* @param x angle within about pi/4
* @param y tail of x, created by remPiOver2
* @return cos(x+y)
*/
private static double cos(double x, double y)
{
if (Configuration.DEBUG && abs(x + y) > 0.7854)
throw new InternalError("Assertion failure");
x = abs(x);
if (x < 1 / TWO_27)
return 1; // If |x| ~< 2**-27, already know answer.
double z = x * x;
double r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6)))));
if (x < 0.3)
return 1 - (0.5 * z - (z * r - x * y));
double qx = (x > 0.78125) ? 0.28125 : (x * 0.25);
return 1 - qx - ((0.5 * z - qx) - (z * r - x * y));
}
示例3: start
import gnu.classpath.Configuration; //导入依赖的package包/类
/**
* Invokes the <code>start()</code> method of the concrete handler.
* <p>
* Depending on the result of processing the command line arguments, this
* handler may be one for signing the jar, or verifying it.
*
* @throws Exception if an exception occurs during the process.
*/
private void start() throws Exception
{
if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
if (verify)
{
JarVerifier jv = new JarVerifier(this);
jv.start();
}
else
{
JarSigner js = new JarSigner(this);
js.start();
}
if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
示例4: validate
import gnu.classpath.Configuration; //导入依赖的package包/类
protected void validate() throws OptionException
{
if (fileAndAlias.size() < 1)
throw new OptionException(Messages.getString("Main.133")); //$NON-NLS-1$
jarFileName = (String) fileAndAlias.get(0);
if (! verify) // must have an ALIAS. use "mykey" if undefined
if (fileAndAlias.size() < 2)
{
if (Configuration.DEBUG)
log.fine("Missing ALIAS argument. Will use [mykey] instead"); //$NON-NLS-1$
alias = "mykey"; //$NON-NLS-1$
}
else
alias = fileAndAlias.get(1);
}
示例5: writeSF
import gnu.classpath.Configuration; //导入依赖的package包/类
/**
* Writes the contents of the <code>.SF</code> file to the designated JAR
* output stream. Line-endings are platform-independent and consist of the
* 2-codepoint sequence <code>0x0D</code> and <code>0x0A</code>.
*
* @param jar the JAR output stream to write a <code>.SF</code> file to.
* @throws IOException if an I/O related exception occurs during the process.
*/
void writeSF(JarOutputStream jar) throws IOException
{
if (this.state != FINISHED)
throw new IllegalStateException(Messages.getString("SFHelper.1")); //$NON-NLS-1$
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JarUtils.writeSFManifest(sfMainAttributes, sfEntries, baos);
sfBytes = baos.toByteArray();
if (Configuration.DEBUG)
log.fine("\n" + Util.dumpString(sfBytes, "+++ sfBytes ")); //$NON-NLS-1$ //$NON-NLS-2$
jar.write(sfBytes);
jar.flush();
this.state = SF_GENERATED;
}
示例6: finishSigning
import gnu.classpath.Configuration; //导入依赖的package包/类
/**
* @param sectionsOnly whether to compute, in addition to the files, the hash
* of the mainfest itself (<code>false</code>) or not (<code>true</code>).
*/
void finishSigning(boolean sectionsOnly) throws IOException
{
if (state != STARTED)
throw new IllegalStateException(Messages.getString("SFHelper.10")); //$NON-NLS-1$
if (sectionsOnly)
return;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
manifest.write(baos);
baos.flush();
String manifestHash = util.hashByteArray(baos.toByteArray());
if (Configuration.DEBUG)
log.fine("Hashed Manifest " + manifestHash); //$NON-NLS-1$
sfMainAttributes.putValue(Main.DIGEST_MANIFEST, manifestHash);
this.state = FINISHED;
}
示例7: getIssuerName
import gnu.classpath.Configuration; //导入依赖的package包/类
/**
* Given an X.509 certificate this method returns the string representation of
* the Issuer Distinguished Name.
*
* @param cert an X.509 certificate.
* @return the string representation of the Issuer's DN.
*/
private String getIssuerName(X509Certificate cert)
{
X500Principal xp = cert.getIssuerX500Principal();
if (xp == null)
{
if (Configuration.DEBUG)
log.fine("Certiticate, with serial number " + cert.getSerialNumber() //$NON-NLS-1$
+ ", has null Issuer. Return [unknown]"); //$NON-NLS-1$
return Messages.getString("SFHelper.14"); //$NON-NLS-1$
}
String result = xp.getName();
if (result == null)
{
if (Configuration.DEBUG)
log.fine("Certiticate, with serial number " + cert.getSerialNumber() //$NON-NLS-1$
+ ", has an Issuer with null DN. Return [unnamed]"); //$NON-NLS-1$
return Messages.getString("SFHelper.17"); //$NON-NLS-1$
}
return result;
}
示例8: getSubjectName
import gnu.classpath.Configuration; //导入依赖的package包/类
/**
* Given an X.509 certificate this method returns the string representation of
* the Subject Distinguished Name.
*
* @param cert an X.509 certificate.
* @return the string representation of the Subject's DN.
*/
private String getSubjectName(X509Certificate cert)
{
X500Principal xp = cert.getSubjectX500Principal();
if (xp == null)
{
if (Configuration.DEBUG)
log.fine("Certiticate, with serial number " + cert.getSerialNumber() //$NON-NLS-1$
+ ", has null Subject. Return [unknown]"); //$NON-NLS-1$
return Messages.getString("SFHelper.14"); //$NON-NLS-1$
}
String result = xp.getName();
if (result == null)
{
if (Configuration.DEBUG)
log.fine("Certiticate, with serial number " + cert.getSerialNumber() //$NON-NLS-1$
+ ", has a Subject with null DN. Return [unnamed]"); //$NON-NLS-1$
return Messages.getString("SFHelper.17"); //$NON-NLS-1$
}
return result;
}
示例9: hashStream
import gnu.classpath.Configuration; //导入依赖的package包/类
/**
* @param stream the input stream to digest.
* @return a base-64 representation of the resulting SHA-1 digest of the
* contents of the designated input stream.
* @throws IOException if an I/O related exception occurs during the process.
*/
String hashStream(InputStream stream) throws IOException
{
BufferedInputStream bis = new BufferedInputStream(stream, 4096);
byte[] buffer = new byte[4096];
int count = 0;
int n;
while ((n = bis.read(buffer)) != - 1)
if (n > 0)
{
sha.update(buffer, 0, n);
count += n;
}
byte[] hash = sha.digest();
if (Configuration.DEBUG)
log.finest("Hashed " + count + " byte(s)");
String result = Base64.encode(hash);
return result;
}
示例10: setup
import gnu.classpath.Configuration; //导入依赖的package包/类
void setup() throws Exception
{
setOutputStreamParam(_certReqFileName);
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
setAliasParam(_alias);
setKeyPasswordNoPrompt(_password);
if (Configuration.DEBUG)
{
log.fine("-certreq handler will use the following options:"); //$NON-NLS-1$
log.fine(" -alias=" + alias); //$NON-NLS-1$
log.fine(" -sigalg=" + _sigAlgorithm); //$NON-NLS-1$
log.fine(" -file=" + _certReqFileName); //$NON-NLS-1$
log.fine(" -storetype=" + storeType); //$NON-NLS-1$
log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
log.fine(" -provider=" + provider); //$NON-NLS-1$
log.fine(" -v=" + verbose); //$NON-NLS-1$
log.fine(" -attributes=" + nullAttributes); //$NON-NLS-1$
}
}
示例11: setup
import gnu.classpath.Configuration; //导入依赖的package包/类
void setup() throws Exception
{
setOutputStreamParam(_certFileName);
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
setAliasParam(_alias);
if (Configuration.DEBUG)
{
log.fine("-export handler will use the following options:"); //$NON-NLS-1$
log.fine(" -alias=" + alias); //$NON-NLS-1$
log.fine(" -file=" + _certFileName); //$NON-NLS-1$
log.fine(" -storetype=" + storeType); //$NON-NLS-1$
log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
log.fine(" -provider=" + provider); //$NON-NLS-1$
log.fine(" -rfc=" + rfc); //$NON-NLS-1$
log.fine(" -v=" + verbose); //$NON-NLS-1$
}
}
示例12: setup
import gnu.classpath.Configuration; //导入依赖的package包/类
void setup() throws Exception
{
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
setAliasParam(_alias);
setKeyPasswordNoPrompt(_password);
setDestinationAlias(_destAlias);
if (Configuration.DEBUG)
{
log.fine("-keyclone handler will use the following options:"); //$NON-NLS-1$
log.fine(" -alias=" + alias); //$NON-NLS-1$
log.fine(" -dest=" + destinationAlias); //$NON-NLS-1$
log.fine(" -storetype=" + storeType); //$NON-NLS-1$
log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
log.fine(" -provider=" + provider); //$NON-NLS-1$
log.fine(" -v=" + verbose); //$NON-NLS-1$
}
}
示例13: start
import gnu.classpath.Configuration; //导入依赖的package包/类
void start() throws KeyStoreException, NoSuchAlgorithmException, IOException,
UnsupportedCallbackException, UnrecoverableKeyException,
CertificateException
{
if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "start"); //$NON-NLS-1$
if (store.containsAlias(destinationAlias))
throw new SecurityException(Messages.getString("KeyCloneCmd.23")); //$NON-NLS-1$
Key privateKey = getAliasPrivateKey();
setNewKeyPassword(_newPassword);
Certificate[] chain = store.getCertificateChain(alias);
store.setKeyEntry(destinationAlias, privateKey, newKeyPasswordChars, chain);
saveKeyStore();
if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "start"); //$NON-NLS-1$
}
示例14: setup
import gnu.classpath.Configuration; //导入依赖的package包/类
void setup() throws Exception
{
setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
setAliasParam(_alias);
setKeyPasswordNoPrompt(_password);
setValidityParam(_validityStr);
if (Configuration.DEBUG)
{
log.fine("-selfcert handler will use the following options:"); //$NON-NLS-1$
log.fine(" -alias=" + alias); //$NON-NLS-1$
log.fine(" -sigalg=" + _sigAlgorithm); //$NON-NLS-1$
log.fine(" -dname=" + _dName); //$NON-NLS-1$
log.fine(" -validity=" + validityInDays); //$NON-NLS-1$
log.fine(" -storetype=" + storeType); //$NON-NLS-1$
log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
log.fine(" -provider=" + provider); //$NON-NLS-1$
log.fine(" -v=" + verbose); //$NON-NLS-1$
}
}
示例15: setup
import gnu.classpath.Configuration; //导入依赖的package包/类
void setup() throws Exception
{
setKeyStoreParams(true, _providerClassName, _ksType, _ksPassword, _ksURL);
setAliasParam(_alias);
setKeyPasswordParam(_password);
setAlgorithmParams(_keyAlgorithm, _sigAlgorithm);
setKeySize(_keySizeStr);
setDName(_dName);
setValidityParam(_validityStr);
if (Configuration.DEBUG)
{
log.fine("-genkey handler will use the following options:"); //$NON-NLS-1$
log.fine(" -alias=" + alias); //$NON-NLS-1$
log.fine(" -keyalg=" + keyPairGenerator.getAlgorithm()); //$NON-NLS-1$
log.fine(" -keysize=" + keySize); //$NON-NLS-1$
log.fine(" -sigalg=" + signatureAlgorithm.getAlgorithm()); //$NON-NLS-1$
log.fine(" -dname=" + distinguishedName); //$NON-NLS-1$
log.fine(" -validity=" + validityInDays); //$NON-NLS-1$
log.fine(" -storetype=" + storeType); //$NON-NLS-1$
log.fine(" -keystore=" + storeURL); //$NON-NLS-1$
log.fine(" -provider=" + provider); //$NON-NLS-1$
log.fine(" -v=" + verbose); //$NON-NLS-1$
}
}