• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Configuration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中gnu.classpath.Configuration的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Configuration类属于gnu.classpath包,在下文中一共展示了Configuration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:BigInteger.java


示例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));
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:StrictMath.java


示例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$
}
 
开发者ID:vilie,项目名称:javify,代码行数:26,代码来源:Main.java


示例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);
}
 
开发者ID:vilie,项目名称:javify,代码行数:17,代码来源:Main.java


示例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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:24,代码来源:SFHelper.java


示例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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:23,代码来源:SFHelper.java


示例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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:28,代码来源:SFHelper.java


示例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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:28,代码来源:SFHelper.java


示例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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:HashUtils.java


示例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$
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:CertReqCmd.java


示例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$
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:ExportCmd.java


示例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$
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:KeyCloneCmd.java


示例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$
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:KeyCloneCmd.java


示例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$
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:SelfCertCmd.java


示例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$
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:GenKeyCmd.java


示例16: setup

import gnu.classpath.Configuration; //导入依赖的package包/类
void setup() throws Exception
{
  setInputStreamParam(_certFileName);
  setKeyStoreParams(true, _providerClassName, _ksType, _ksPassword, _ksURL);
  setAliasParam(_alias);
  setKeyPasswordNoPrompt(_password);
  if (Configuration.DEBUG)
    {
      log.fine("-import 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("  -noprompt=" + noPrompt); //$NON-NLS-1$
      log.fine("  -trustcacerts=" + trustCACerts); //$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$
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:ImportCmd.java


示例17: importCertificate

import gnu.classpath.Configuration; //导入依赖的package包/类
/**
 * If the reply is a single X.509 certificate, keytool attempts to establish a
 * trust chain, starting at the certificate reply and ending at a self-signed
 * certificate (belonging to a root CA). The certificate reply and the
 * hierarchy of certificates used to authenticate the certificate reply form
 * the new certificate chain of alias. If a trust chain cannot be established,
 * the certificate reply is not imported. In this case, keytool does not print
 * out the certificate, nor does it prompt the user to verify it. This is
 * because it is very hard (if not impossible) for a user to determine the
 * authenticity of the certificate reply.
 *
 * @param certificate the certificate reply to import into the key store.
 * @throws NoSuchAlgorithmException
 * @throws CertPathValidatorException
 * @throws UnsupportedCallbackException
 * @throws IOException
 * @throws UnrecoverableKeyException
 * @throws KeyStoreException
 * @throws CertificateException
 */
private void importCertificate(Certificate certificate)
    throws NoSuchAlgorithmException, CertPathValidatorException,
    KeyStoreException, UnrecoverableKeyException, IOException,
    UnsupportedCallbackException, CertificateException
{
  if (Configuration.DEBUG)
    log.entering(this.getClass().getName(), "importCertificate", certificate); //$NON-NLS-1$
  LinkedList reply = new LinkedList();
  reply.addLast(certificate);

  if (! findTrustAndUpdate(reply, false))
    throw new CertPathValidatorException(Messages.getString("ImportCmd.34")); //$NON-NLS-1$

  Certificate[] newChain = (Certificate[]) reply.toArray(new Certificate[0]);
  Key privateKey = getAliasPrivateKey();
  store.setKeyEntry(alias, privateKey, keyPasswordChars, newChain);
  saveKeyStore();
  if (Configuration.DEBUG)
    log.exiting(this.getClass().getName(), "importCertificate"); //$NON-NLS-1$
}
 
开发者ID:vilie,项目名称:javify,代码行数:41,代码来源:ImportCmd.java


示例18: setup

import gnu.classpath.Configuration; //导入依赖的package包/类
void setup() throws Exception
{
  setOutputStreamParam(null); // use stdout
  setKeyStoreParams(_providerClassName, _ksType, _ksPassword, _ksURL);
  all = _alias == null;
  if (! all)
    setAliasParam(_alias);

  if (verbose & rfc)
    {
      if (Configuration.DEBUG)
        log.fine("Both -v and -rfc options were found on the command line. " //$NON-NLS-1$
                 + "Only the former will be considered"); //$NON-NLS-1$
      rfc = false;
    }
  if (Configuration.DEBUG)
    {
      log.fine("-list handler will use the following options:"); //$NON-NLS-1$
      log.fine("  -alias=" + alias); //$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("  -rfc=" + rfc); //$NON-NLS-1$
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:27,代码来源:ListCmd.java


示例19: setProviderClassNameParam

import gnu.classpath.Configuration; //导入依赖的package包/类
/**
 * Set a security provider class name to (install and) use for key store
 * related operations.
 *
 * @param className the possibly null, fully qualified class name of a
 *          security provider to add, if it is not already installed, to the
 *          set of available providers.
 */
private void setProviderClassNameParam(String className)
{
  if (Configuration.DEBUG)
    log.fine("setProviderClassNameParam(" + className + ")"); //$NON-NLS-1$ //$NON-NLS-2$
  if (className != null && className.trim().length() > 0)
    {
      className = className.trim();
      SecurityProviderInfo spi = ProviderUtil.addProvider(className);
      provider = spi.getProvider();
      if (provider == null)
        {
          if (Configuration.DEBUG)
            log.fine("Was unable to add provider from class " + className);
        }
      providerNdx = spi.getPosition();
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:26,代码来源:Command.java


示例20: saveKeyStore

import gnu.classpath.Configuration; //导入依赖的package包/类
/**
 * Saves the key store using the designated password. This operation is called
 * by handlers if/when the key store password has changed, or amendements have
 * been made to the contents of the store; e.g. addition of a new Key Entry or
 * a Trusted Certificate.
 *
 * @param password the password protecting the key store.
 * @throws IOException if an I/O related exception occurs during the process.
 * @throws CertificateException if any of the certificates in the current key
 *           store could not be persisted.
 * @throws NoSuchAlgorithmException if a required data integrity algorithm
 *           implementation was not found.
 * @throws KeyStoreException if the key store has not been loaded previously.
 */
protected void saveKeyStore(char[] password) throws IOException,
    KeyStoreException, NoSuchAlgorithmException, CertificateException
{
  if (Configuration.DEBUG)
    log.entering(this.getClass().getName(), "saveKeyStore"); //$NON-NLS-1$
  URLConnection con = storeURL.openConnection();
  con.setDoOutput(true);
  con.setUseCaches(false);
  OutputStream out = con.getOutputStream();
  if (verbose)
    System.out.println(Messages.getFormattedString("Command.63", storeURL.getPath())); //$NON-NLS-1$

  store.store(out, password);
  out.flush();
  out.close();
  if (Configuration.DEBUG)
    log.exiting(this.getClass().getName(), "saveKeyStore"); //$NON-NLS-1$
}
 
开发者ID:vilie,项目名称:javify,代码行数:33,代码来源:Command.java



注:本文中的gnu.classpath.Configuration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ItemFood类代码示例发布时间:2022-05-22
下一篇:
Java TridentTopologyBuilder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap