public static String toString(final String signerConf, final boolean verbose, final boolean ignoreSensitiveInfo) { String tmpSignerConf = ParamUtil.requireNonBlank("signerConf", signerConf); if (ignoreSensitiveInfo) { tmpSignerConf = eraseSensitiveData(tmpSignerConf); } if (verbose || tmpSignerConf.length() < 101) { return tmpSignerConf; } else { return new StringBuilder().append(tmpSignerConf.substring(0, 97)).append("...") .toString(); } }
sb.append("private key and public key does not match, "); sb.append("key type='").append(signerType).append("'; "); String pwd = signerConf.getConfValue("password"); if (pwd != null) { signerConf.putConfEntry("password", "****"); signerConf.putConfEntry("algo", signatureAlgoName); sb.append("conf='").append(signerConf.getConf()); X509Certificate cert = signer.getCertificate(); if (cert != null) {
@Override public String toString() { return toString(true, true); }
public String toString(final boolean verbose, final boolean ignoreSensitiveInfo) { String conf = getConf(); if (ignoreSensitiveInfo) { conf = eraseSensitiveData(conf); } StringBuilder sb = new StringBuilder(conf.length() + 50); sb.append("conf: "); sb.append(conf); if (hashAlgo != null) { sb.append("\nhash algo: ").append(hashAlgo.getName()); } if (signatureAlgoControl != null) { sb.append("\nsiganture algo control: ").append(signatureAlgoControl); } return sb.toString(); }
public static AlgorithmIdentifier getSigAlgId(final PublicKey pubKey, final SignerConf signerConf) throws NoSuchAlgorithmException { ParamUtil.requireNonNull("signerConf", signerConf); if (signerConf.hashAlgo() == null) { return getSigAlgId(signerConf.getConfValue("algo")); } else { SignatureAlgoControl algoControl = signerConf.signatureAlgoControl(); HashAlgoType hashAlgo = signerConf.hashAlgo(); boolean rsaMgf1 = (algoControl == null) ? false : algoControl.isRsaMgf1(); boolean dsaPlain = (algoControl == null) ? false : algoControl.isDsaPlain(); if (pubKey instanceof RSAPublicKey) { return getRSASigAlgId(hashAlgo, rsaMgf1); } else if (pubKey instanceof ECPublicKey) { return getECDSASigAlgId(hashAlgo, dsaPlain); } else if (pubKey instanceof DSAPublicKey) { return getDSASigAlgId(hashAlgo); } else { throw new NoSuchAlgorithmException("Unknown public key '" + pubKey.getClass().getName()); } } }
for (String[] m : signerConfs) { String algo = m[0]; SignerConf signerConf = new SignerConf(m[1]); ConcurrentContentSigner signer; try {
String str = conf.getConfValue("parallelism"); int parallelism = securityFactory.getDfltSignerParallelism(); if (str != null) { String passwordHint = conf.getConfValue("password"); char[] password; if (passwordHint == null) { str = conf.getConfValue("keystore"); String keyLabel = conf.getConfValue("key-label"); String algoName = conf.getConfValue("algo"); if (algoName != null) { try { if (conf.getHashAlgo() == null) { signatureAlgId = AlgorithmUtil.getSigAlgId(null, conf); } else {
public static AlgorithmIdentifier getSigAlgId(PublicKey pubKey, SignerConf signerConf) throws NoSuchAlgorithmException { if (Args.notNull(signerConf, "signerConf").getHashAlgo() == null) { return getSigAlgId(signerConf.getConfValue("algo")); } else { SignatureAlgoControl algoControl = signerConf.getSignatureAlgoControl(); HashAlgo hashAlgo = signerConf.getHashAlgo(); if (pubKey instanceof RSAPublicKey) { boolean rsaMgf1 = (algoControl == null) ? false : algoControl.isRsaMgf1(); return getRSASigAlgId(hashAlgo, rsaMgf1); } else if (pubKey instanceof ECPublicKey) { boolean dsaPlain = (algoControl == null) ? false : algoControl.isDsaPlain(); boolean gm = (algoControl == null) ? false : algoControl.isGm(); return getECSigAlgId(hashAlgo, dsaPlain, gm); } else if (pubKey instanceof DSAPublicKey) { return getDSASigAlgId(hashAlgo); } else { throw new NoSuchAlgorithmException("Unknown public key '" + pubKey.getClass().getName()); } } }
public SignerConf(String conf) { this.hashAlgo = null; this.signatureAlgoControl = null; this.confPairs = new ConfPairs(Args.notBlank(conf, "conf")); if (getConfValue("algo") == null) { throw new IllegalArgumentException("conf must contain the entry 'algo'"); } }
private ConcurrentContentSigner newKeystoreSigner(final SecurityFactory securityFactory, final String type, final SignerConf conf, final X509Certificate[] certificateChain) throws ObjectCreationException { String str = conf.getConfValue("parallelism"); int parallelism = securityFactory.getDefaultSignerParallelism(); if (str != null) { String passwordHint = conf.getConfValue("password"); char[] password; if (passwordHint == null) { str = conf.getConfValue("keystore"); String keyLabel = conf.getConfValue("key-label"); String algoName = conf.getConfValue("algo"); if (algoName != null) { try { if (conf.hashAlgo() == null) { signatureAlgId = AlgorithmUtil.getSigAlgId(null, conf); } else {
@Override public KeyCertPair createPrivateKeyAndCert(final String type, final SignerConf conf, final X509Certificate cert) throws ObjectCreationException { conf.putConfEntry("parallelism", Integer.toString(1)); X509Certificate[] certs = null; if (cert != null) { certs = new X509Certificate[]{cert}; } ConcurrentContentSigner signer = signerFactoryRegister.newSigner(this, type, conf, certs); PrivateKey privateKey = (PrivateKey) signer.getSigningKey(); return new KeyCertPair(privateKey, signer.getCertificate()); }
public static SignerConf getKeystoreSignerConf(final String keystoreFile, final String password, final int parallelism, final HashAlgoType hashAlgo, final SignatureAlgoControl signatureAlgoControl) { ParamUtil.requireNonBlank("keystoreFile", keystoreFile); ParamUtil.requireNonBlank("password", password); ParamUtil.requireMin("parallelism", parallelism, 1); ParamUtil.requireNonNull("hashAlgo", hashAlgo); ConfPairs conf = new ConfPairs("password", password); conf.putPair("parallelism", Integer.toString(parallelism)); conf.putPair("keystore", "file:" + keystoreFile); return new SignerConf(conf.getEncoded(), hashAlgo, signatureAlgoControl); }
public String toString(boolean verbose, boolean ignoreSensitiveInfo) { String conf = getConf(); if (ignoreSensitiveInfo) { conf = eraseSensitiveData(conf); } StringBuilder sb = new StringBuilder(conf.length() + 50); sb.append("conf: "); sb.append(conf); if (hashAlgo != null) { sb.append("\nhash algo: ").append(hashAlgo.getName()); } if (signatureAlgoControl != null) { sb.append("\nsiganture algo control: ").append(signatureAlgoControl); } return sb.toString(); }
String str = conf.getConfValue("parallelism"); int parallelism = securityFactory.getDfltSignerParallelism(); if (str != null) { String moduleName = conf.getConfValue("module"); str = conf.getConfValue("slot"); Integer slotIndex = (str == null) ? null : Integer.parseInt(str); str = conf.getConfValue("slot-id"); Long slotId = (str == null) ? null : Long.parseLong(str); String keyLabel = conf.getConfValue("key-label"); str = conf.getConfValue("key-id"); byte[] keyId = null; if (str != null) { String algoName = conf.getConfValue("algo"); if (algoName != null) { try { } else { AlgorithmIdentifier signatureAlgId; if (conf.getHashAlgo() == null) { signatureAlgId = AlgorithmUtil.getSigAlgId(null, conf); } else {
public SignerConf(final String conf) { this.hashAlgo = null; this.signatureAlgoControl = null; ParamUtil.requireNonBlank("conf", conf); this.confPairs = new ConfPairs(conf); if (getConfValue("algo") == null) { throw new IllegalArgumentException("conf must contain the entry 'algo'"); } }
String str = conf.getConfValue("parallelism"); int parallelism = securityFactory.getDefaultSignerParallelism(); if (str != null) { String moduleName = conf.getConfValue("module"); str = conf.getConfValue("slot"); Integer slotIndex = (str == null) ? null : Integer.parseInt(str); str = conf.getConfValue("slot-id"); Long slotId = (str == null) ? null : Long.parseLong(str); String keyLabel = conf.getConfValue("key-label"); str = conf.getConfValue("key-id"); byte[] keyId = null; if (str != null) { String algoName = conf.getConfValue("algo"); if (algoName != null) { try { } else { AlgorithmIdentifier signatureAlgId; if (conf.hashAlgo() == null) { signatureAlgId = AlgorithmUtil.getSigAlgId(null, conf); } else {
@Override public KeyCertPair createPrivateKeyAndCert(String type, SignerConf conf, X509Certificate cert) throws ObjectCreationException { conf.putConfEntry("parallelism", Integer.toString(1)); X509Certificate[] certs = null; if (cert != null) { certs = new X509Certificate[]{cert}; } ConcurrentContentSigner signer = signerFactoryRegister.newSigner(this, type, conf, certs); PrivateKey privateKey = (PrivateKey) signer.getSigningKey(); return new KeyCertPair(privateKey, signer.getCertificate()); }
return new SignerConf(conf.getEncoded());
static String signerConfToString(String signerConf, boolean verbose, boolean ignoreSensitiveInfo) { ParamUtil.requireNonBlank("signerConf", signerConf); if (ignoreSensitiveInfo) { signerConf = SignerConf.eraseSensitiveData(signerConf); } if (verbose || signerConf.length() < 101) { return signerConf; } else { return StringUtil.concat(signerConf.substring(0, 97), "..."); } }
sb.append("private key and public key does not match, "); sb.append("key type='").append(signerType).append("'; "); String pwd = signerConf.getConfValue("password"); if (pwd != null) { signerConf.putConfEntry("password", "****"); signerConf.putConfEntry("algo", signatureAlgoName); sb.append("conf='").append(signerConf.getConf()); X509Certificate cert = signer.getCertificate(); if (cert != null) {