本文整理汇总了Java中org.bouncycastle.util.Strings类的典型用法代码示例。如果您正苦于以下问题:Java Strings类的具体用法?Java Strings怎么用?Java Strings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Strings类属于org.bouncycastle.util包,在下文中一共展示了Strings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getByName
import org.bouncycastle.util.Strings; //导入依赖的package包/类
public static X9ECParameters getByName(
String name)
{
ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)objIds.get(Strings.toUpperCase(name));
if (oid != null)
{
return getByOID(oid);
}
return null;
}
示例2: getSigAlgID
import org.bouncycastle.util.Strings; //导入依赖的package包/类
static AlgorithmIdentifier getSigAlgID(
DERObjectIdentifier sigOid,
String algorithmName)
{
if (noParams.contains(sigOid))
{
return new AlgorithmIdentifier(sigOid);
}
algorithmName = Strings.toUpperCase(algorithmName);
if (params.containsKey(algorithmName))
{
return new AlgorithmIdentifier(sigOid, (ASN1Encodable)params.get(algorithmName));
}
else
{
return new AlgorithmIdentifier(sigOid, DERNull.INSTANCE);
}
}
示例3: decodeOID
import org.bouncycastle.util.Strings; //导入依赖的package包/类
private ASN1ObjectIdentifier decodeOID(
String name,
Hashtable lookUp)
{
name = name.trim();
if (Strings.toUpperCase(name).startsWith("OID."))
{
return new ASN1ObjectIdentifier(name.substring(4));
}
else if (name.charAt(0) >= '0' && name.charAt(0) <= '9')
{
return new ASN1ObjectIdentifier(name);
}
ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)lookUp.get(Strings.toLowerCase(name));
if (oid == null)
{
throw new IllegalArgumentException("Unknown object id - " + name + " - passed to distinguished name");
}
return oid;
}
示例4: canonicalize
import org.bouncycastle.util.Strings; //导入依赖的package包/类
private String canonicalize(String s)
{
String value = Strings.toLowerCase(s.trim());
if (value.length() > 0 && value.charAt(0) == '#')
{
ASN1Primitive obj = decodeObject(value);
if (obj instanceof ASN1String)
{
value = Strings.toLowerCase(((ASN1String)obj).getString().trim());
}
}
return value;
}
示例5: decodeAttrName
import org.bouncycastle.util.Strings; //导入依赖的package包/类
public static ASN1ObjectIdentifier decodeAttrName(
String name,
Hashtable lookUp)
{
if (Strings.toUpperCase(name).startsWith("OID."))
{
return new ASN1ObjectIdentifier(name.substring(4));
}
else if (name.charAt(0) >= '0' && name.charAt(0) <= '9')
{
return new ASN1ObjectIdentifier(name);
}
ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)lookUp.get(Strings.toLowerCase(name));
if (oid == null)
{
throw new IllegalArgumentException("Unknown object id - " + name + " - passed to distinguished name");
}
return oid;
}
示例6: canonicalize
import org.bouncycastle.util.Strings; //导入依赖的package包/类
public static String canonicalize(String s)
{
String value = Strings.toLowerCase(s.trim());
if (value.length() > 0 && value.charAt(0) == '#')
{
ASN1Primitive obj = decodeObject(value);
if (obj instanceof ASN1String)
{
value = Strings.toLowerCase(((ASN1String)obj).getString().trim());
}
}
value = stripInternalSpaces(value);
return value;
}
示例7: DERIA5String
import org.bouncycastle.util.Strings; //导入依赖的package包/类
/**
* Constructor with optional validation.
*
* @param string the base string to wrap.
* @param validate whether or not to check the string.
* @throws IllegalArgumentException if validate is true and the string
* contains characters that should not be in an IA5String.
*/
public DERIA5String(
String string,
boolean validate)
{
if (string == null)
{
throw new NullPointerException("string cannot be null");
}
if (validate && !isIA5String(string))
{
throw new IllegalArgumentException("string contains illegal characters");
}
this.string = Strings.toByteArray(string);
}
示例8: engineSetMode
import org.bouncycastle.util.Strings; //导入依赖的package包/类
public void engineSetMode(String mode)
throws NoSuchAlgorithmException
{
String modeName = Strings.toUpperCase(mode);
if (modeName.equals("NONE"))
{
dhaesMode = false;
}
else if (modeName.equals("DHAES"))
{
dhaesMode = true;
}
else
{
throw new IllegalArgumentException("can't support mode " + mode);
}
}
示例9: engineSetPadding
import org.bouncycastle.util.Strings; //导入依赖的package包/类
public void engineSetPadding(String padding)
throws NoSuchPaddingException
{
String paddingName = Strings.toUpperCase(padding);
// TDOD: make this meaningful...
if (paddingName.equals("NOPADDING"))
{
}
else if (paddingName.equals("PKCS5PADDING") || paddingName.equals("PKCS7PADDING"))
{
}
else
{
throw new NoSuchPaddingException("padding not available with IESCipher");
}
}
示例10: engineSetMode
import org.bouncycastle.util.Strings; //导入依赖的package包/类
protected void engineSetMode(
String mode)
throws NoSuchAlgorithmException
{
String md = Strings.toUpperCase(mode);
if (md.equals("NONE") || md.equals("ECB"))
{
return;
}
if (md.equals("1"))
{
privateKeyOnly = true;
publicKeyOnly = false;
return;
}
else if (md.equals("2"))
{
privateKeyOnly = false;
publicKeyOnly = true;
return;
}
throw new NoSuchAlgorithmException("can't support mode " + mode);
}
示例11: getSigAlgID
import org.bouncycastle.util.Strings; //导入依赖的package包/类
static AlgorithmIdentifier getSigAlgID(
DERObjectIdentifier sigOid,
String algorithmName)
{
if (noParams.contains(sigOid))
{
return new AlgorithmIdentifier(sigOid);
}
algorithmName = Strings.toUpperCase(algorithmName);
if (params.containsKey(algorithmName))
{
return new AlgorithmIdentifier(sigOid, (DEREncodable)params.get(algorithmName));
}
else
{
return new AlgorithmIdentifier(sigOid, new DERNull());
}
}
示例12: encode
import org.bouncycastle.util.Strings; //导入依赖的package包/类
/**
* Encode this {@link URLAndHash} to an {@link OutputStream}.
*
* @param output the {@link OutputStream} to encode to.
* @throws IOException
*/
public void encode(OutputStream output)
throws IOException
{
byte[] urlEncoding = Strings.toByteArray(this.url);
TlsUtils.writeOpaque16(urlEncoding, output);
if (this.sha1Hash == null)
{
TlsUtils.writeUint8(0, output);
}
else
{
TlsUtils.writeUint8(1, output);
output.write(this.sha1Hash);
}
}
示例13: toString
import org.bouncycastle.util.Strings; //导入依赖的package包/类
public String toString()
{
StringBuffer buf = new StringBuffer();
String nl = Strings.lineSeparator();
buf.append("RSA Private CRT Key").append(nl);
buf.append(" modulus: ").append(this.getModulus().toString(16)).append(nl);
buf.append(" public exponent: ").append(this.getPublicExponent().toString(16)).append(nl);
buf.append(" private exponent: ").append(this.getPrivateExponent().toString(16)).append(nl);
buf.append(" primeP: ").append(this.getPrimeP().toString(16)).append(nl);
buf.append(" primeQ: ").append(this.getPrimeQ().toString(16)).append(nl);
buf.append(" primeExponentP: ").append(this.getPrimeExponentP().toString(16)).append(nl);
buf.append(" primeExponentQ: ").append(this.getPrimeExponentQ().toString(16)).append(nl);
buf.append(" crtCoefficient: ").append(this.getCrtCoefficient().toString(16)).append(nl);
return buf.toString();
}
示例14: toString
import org.bouncycastle.util.Strings; //导入依赖的package包/类
public String toString()
{
StringBuffer buf = new StringBuffer();
String sep = Strings.lineSeparator();
buf.append("CRLDistPoint:");
buf.append(sep);
DistributionPoint dp[] = getDistributionPoints();
for (int i = 0; i != dp.length; i++)
{
buf.append(" ");
buf.append(dp[i]);
buf.append(sep);
}
return buf.toString();
}
示例15: toString
import org.bouncycastle.util.Strings; //导入依赖的package包/类
public String toString()
{
String sep = Strings.lineSeparator();
StringBuffer buf = new StringBuffer();
buf.append("DistributionPoint: [");
buf.append(sep);
if (distributionPoint != null)
{
appendObject(buf, sep, "distributionPoint", distributionPoint.toString());
}
if (reasons != null)
{
appendObject(buf, sep, "reasons", reasons.toString());
}
if (cRLIssuer != null)
{
appendObject(buf, sep, "cRLIssuer", cRLIssuer.toString());
}
buf.append("]");
buf.append(sep);
return buf.toString();
}