本文整理汇总了Java中org.bouncycastle.asn1.DERObject类的典型用法代码示例。如果您正苦于以下问题:Java DERObject类的具体用法?Java DERObject怎么用?Java DERObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DERObject类属于org.bouncycastle.asn1包,在下文中一共展示了DERObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toASN1Object
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* SignedData ::= SEQUENCE {
* version Version,
* digestAlgorithms DigestAlgorithmIdentifiers,
* contentInfo ContentInfo,
* certificates
* [0] IMPLICIT ExtendedCertificatesAndCertificates
* OPTIONAL,
* crls
* [1] IMPLICIT CertificateRevocationLists OPTIONAL,
* signerInfos SignerInfos }
* </pre>
*/
public DERObject toASN1Object()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(version);
v.add(digestAlgorithms);
v.add(contentInfo);
if (certificates != null)
{
v.add(new DERTaggedObject(false, 0, certificates));
}
if (crls != null)
{
v.add(new DERTaggedObject(false, 1, crls));
}
v.add(signerInfos);
return new BERSequence(v);
}
示例2: dumpAsString
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
* Dump out the object as a string.
*
* @param obj the object to be dumped
* @param verbose if true, dump out the contents of octet and bit strings.
* @return the resulting string.
*/
public static String dumpAsString(
Object obj,
boolean verbose)
{
StringBuffer buf = new StringBuffer();
if (obj instanceof DERObject)
{
_dumpAsString("", verbose, (DERObject)obj, buf);
}
else if (obj instanceof DEREncodable)
{
_dumpAsString("", verbose, ((DEREncodable)obj).getDERObject(), buf);
}
else
{
return "unknown object type " + obj.toString();
}
return buf.toString();
}
示例3: convertAltNameType
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
* Convert types returned by Bouncy Castle X509ExtensionUtil.getSubjectAlternativeNames(X509Certificate) to be
* consistent with what is documented for: java.security.cert.X509Certificate#getSubjectAlternativeNames.
*
* @param nameType the alt name type
* @param nameValue the alt name value
* @return converted representation of name value, based on type
*/
private static Object convertAltNameType(Integer nameType, Object nameValue) {
Logger log = getLogger();
if (DIRECTORY_ALT_NAME.equals(nameType) || DNS_ALT_NAME.equals(nameType) || RFC822_ALT_NAME.equals(nameType)
|| URI_ALT_NAME.equals(nameType) || REGISTERED_ID_ALT_NAME.equals(nameType)) {
// these are just strings in the appropriate format already, return as-is
return nameValue;
}
if (IP_ADDRESS_ALT_NAME.equals(nameType)) {
// this is a byte[], IP addr in network byte order
return IPAddressHelper.addressToString((byte[]) nameValue);
}
if (EDI_PARTY_ALT_NAME.equals(nameType) || X400ADDRESS_ALT_NAME.equals(nameType)
|| OTHER_ALT_NAME.equals(nameType)) {
// these have no defined representation, just return a DER-encoded byte[]
return ((DERObject) nameValue).getDEREncoded();
}
log.warn("Encountered unknown alt name type '{}', adding as-is", nameType);
return nameValue;
}
示例4: extractAuthorityInformationAccess
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
public static void extractAuthorityInformationAccess(List<String> OCSPUrl,
DERObject aiaExt) {
AuthorityInformationAccess aia = AuthorityInformationAccess
.getInstance(aiaExt);
AccessDescription[] accessDescriptions = aia.getAccessDescriptions();
DERObjectIdentifier OCSPOid = new DERObjectIdentifier(
"1.3.6.1.5.5.7.48.1"); //$NON-NLS-1$
for (AccessDescription accessDescription : accessDescriptions) {
GeneralName generalName = accessDescription.getAccessLocation();
String nextName = generalName.getName().toString();
DERObjectIdentifier acessMethod = accessDescription
.getAccessMethod();
if (acessMethod.equals(OCSPOid)) {
OCSPUrl.add(nextName);
}
}
}
示例5: toASN1Object
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
* Produce an object suitable for an ASN1OutputStream.
* <p/>
* Returns:
* <p/>
* <pre>
* CertificatePair ::= SEQUENCE {
* forward [0] Certificate OPTIONAL,
* reverse [1] Certificate OPTIONAL,
* -- at least one of the pair shall be present -- }
* </pre>
*
* @return a DERObject
*/
public DERObject toASN1Object()
{
ASN1EncodableVector vec = new ASN1EncodableVector();
if (forward != null)
{
vec.add(new DERTaggedObject(0, forward));
}
if (reverse != null)
{
vec.add(new DERTaggedObject(1, reverse));
}
return new DERSequence(vec);
}
示例6: toASN1Object
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
public DERObject toASN1Object()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (distributionPoint != null)
{
//
// as this is a CHOICE it must be explicitly tagged
//
v.add(new DERTaggedObject(0, distributionPoint));
}
if (reasons != null)
{
v.add(new DERTaggedObject(false, 1, reasons));
}
if (cRLIssuer != null)
{
v.add(new DERTaggedObject(false, 2, cRLIssuer));
}
return new DERSequence(v);
}
示例7: toASN1Object
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* V2Form ::= SEQUENCE {
* issuerName GeneralNames OPTIONAL,
* baseCertificateID [0] IssuerSerial OPTIONAL,
* objectDigestInfo [1] ObjectDigestInfo OPTIONAL
* -- issuerName MUST be present in this profile
* -- baseCertificateID and objectDigestInfo MUST NOT
* -- be present in this profile
* }
* </pre>
*/
public DERObject toASN1Object()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (issuerName != null)
{
v.add(issuerName);
}
if (baseCertificateID != null)
{
v.add(new DERTaggedObject(false, 0, baseCertificateID));
}
if (objectDigestInfo != null)
{
v.add(new DERTaggedObject(false, 1, objectDigestInfo));
}
return new DERSequence(v);
}
示例8: toASN1Object
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
* Produce an object suitable for an ASN1OutputStream.
*/
public DERObject toASN1Object()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (keyidentifier != null)
{
v.add(new DERTaggedObject(false, 0, keyidentifier));
}
if (certissuer != null)
{
v.add(new DERTaggedObject(false, 1, certissuer));
}
if (certserno != null)
{
v.add(new DERTaggedObject(false, 2, certserno));
}
return new DERSequence(v);
}
示例9: toASN1Object
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
*
* <pre>
*
* IetfAttrSyntax ::= SEQUENCE {
* policyAuthority [0] GeneralNames OPTIONAL,
* values SEQUENCE OF CHOICE {
* octets OCTET STRING,
* oid OBJECT IDENTIFIER,
* string UTF8String
* }
* }
*
* </pre>
*/
public DERObject toASN1Object()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (policyAuthority != null)
{
v.add(new DERTaggedObject(0, policyAuthority));
}
ASN1EncodableVector v2 = new ASN1EncodableVector();
for (Enumeration i = values.elements(); i.hasMoreElements();)
{
v2.add((ASN1Encodable)i.nextElement());
}
v.add(new DERSequence(v2));
return new DERSequence(v);
}
示例10: getDERObject
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
public DERObject getDERObject()
{
ASN1EncodableVector v = new ASN1EncodableVector();
ASN1EncodableVector subV = new ASN1EncodableVector();
v.add(id);
subV.add(octStr);
subV.add(iterationCount);
if (keyLength != null)
{
subV.add(keyLength);
}
v.add(new DERSequence(subV));
return new DERSequence(v);
}
示例11: toASN1Object
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
* <pre>
* Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
*
* Extension ::= SEQUENCE {
* extnId EXTENSION.&id ({ExtensionSet}),
* critical BOOLEAN DEFAULT FALSE,
* extnValue OCTET STRING }
* </pre>
*/
public DERObject toASN1Object()
{
ASN1EncodableVector vec = new ASN1EncodableVector();
Enumeration e = ordering.elements();
while (e.hasMoreElements())
{
DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
X509Extension ext = (X509Extension)extensions.get(oid);
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(oid);
if (ext.isCritical())
{
v.add(new DERBoolean(true));
}
v.add(ext.getValue());
vec.add(new DERSequence(v));
}
return new DERSequence(vec);
}
示例12: toASN1Object
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
public DERObject toASN1Object()
{
ASN1EncodableVector av = new ASN1EncodableVector();
if (noticeRef != null)
{
av.add(noticeRef);
}
if (explicitText != null)
{
av.add(explicitText);
}
return new DERSequence(av);
}
示例13: toASN1Object
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
* Produce an object suitable for an ASN1OutputStream.
*
* Returns:
*
* <pre>
* GeneralSubtree ::= SEQUENCE
* {
* base GeneralName,
* minimum [0] BaseDistance DEFAULT 0,
* maximum [1] BaseDistance OPTIONAL
* }
* </pre>
*
* @return a DERObject
*/
public DERObject toASN1Object()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(base);
if (minimum != null && !minimum.getValue().equals(ZERO))
{
v.add(new DERTaggedObject(false, 0, minimum));
}
if (maximum != null)
{
v.add(new DERTaggedObject(false, 1, maximum));
}
return new DERSequence(v);
}
示例14: ExtendedKeyUsage
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
public ExtendedKeyUsage(
Vector usages)
{
ASN1EncodableVector v = new ASN1EncodableVector();
Enumeration e = usages.elements();
while (e.hasMoreElements())
{
DERObject o = (DERObject)e.nextElement();
v.add(o);
this.usageTable.put(o, o);
}
this.seq = new DERSequence(v);
}
示例15: toASN1Object
import org.bouncycastle.asn1.DERObject; //导入依赖的package包/类
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* BasicConstraints := SEQUENCE {
* cA BOOLEAN DEFAULT FALSE,
* pathLenConstraint INTEGER (0..MAX) OPTIONAL
* }
* </pre>
*/
public DERObject toASN1Object()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (cA != null)
{
v.add(cA);
}
if (pathLenConstraint != null) // yes some people actually do this when cA is false...
{
v.add(pathLenConstraint);
}
return new DERSequence(v);
}