当前位置: 首页>>代码示例>>Java>>正文


Java DERUTF8String类代码示例

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


DERUTF8String类属于org.bouncycastle.asn1包,在下文中一共展示了DERUTF8String类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getControl

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
/**
 * Return a control value of the specified type.
 *
 * @param type the type OID for the control value we are checking for.
 * @return the control value if present, null otherwise.
 */
public Control getControl(ASN1ObjectIdentifier type)
{
    AttributeTypeAndValue found = findControl(type);

    if (found != null)
    {
        if (found.getType().equals(CRMFObjectIdentifiers.id_regCtrl_pkiArchiveOptions))
        {
            return new PKIArchiveControl(PKIArchiveOptions.getInstance(found.getValue()));
        }
        if (found.getType().equals(CRMFObjectIdentifiers.id_regCtrl_regToken))
        {
            return new RegTokenControl(DERUTF8String.getInstance(found.getValue()));
        }
        if (found.getType().equals(CRMFObjectIdentifiers.id_regCtrl_authenticator))
        {
            return new AuthenticatorControl(DERUTF8String.getInstance(found.getValue()));
        }
    }

    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:29,代码来源:CertificateRequestMessage.java

示例2: SignerLocation

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
public SignerLocation(
    DERUTF8String   countryName,
    DERUTF8String   localityName,
    ASN1Sequence    postalAddress)
{
    if (postalAddress != null && postalAddress.size() > 6)
    {
        throw new IllegalArgumentException("postal address must contain less than 6 strings");
    }

    if (countryName != null)
    {
        this.countryName = DERUTF8String.getInstance(countryName.toASN1Primitive());
    }

    if (localityName != null)
    {
        this.localityName = DERUTF8String.getInstance(localityName.toASN1Primitive());
    }

    if (postalAddress != null)
    {
        this.postalAddress = ASN1Sequence.getInstance(postalAddress.toASN1Primitive());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:26,代码来源:SignerLocation.java

示例3: EncKeyWithID

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
private EncKeyWithID(ASN1Sequence seq)
{
    this.privKeyInfo = PrivateKeyInfo.getInstance(seq.getObjectAt(0));

    if (seq.size() > 1)
    {
        if (!(seq.getObjectAt(1) instanceof DERUTF8String))
        {
            this.identifier = GeneralName.getInstance(seq.getObjectAt(1));
        }
        else
        {
            this.identifier = (ASN1Encodable)seq.getObjectAt(1);
        }
    }
    else
    {
        this.identifier = null;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:EncKeyWithID.java

示例4: MetaData

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
private MetaData(ASN1Sequence seq)
{
    this.hashProtected = ASN1Boolean.getInstance(seq.getObjectAt(0));

    int index = 1;

    if (index < seq.size() && seq.getObjectAt(index) instanceof DERUTF8String)
    {
        this.fileName = DERUTF8String.getInstance(seq.getObjectAt(index++));
    }
    if (index < seq.size() && seq.getObjectAt(index) instanceof DERIA5String)
    {
        this.mediaType = DERIA5String.getInstance(seq.getObjectAt(index++));
    }
    if (index < seq.size())
    {
        this.otherMetaData = Attributes.getInstance(seq.getObjectAt(index++));
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:20,代码来源:MetaData.java

示例5: toASN1Primitive

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
@Override
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector vector = new ASN1EncodableVector();
    vector.add(new Asn1P11SlotIdentifier(slotId));
    vector.add(new DERUTF8String(label));
    vector.add(new ASN1Integer(keysize));
    if (publicExponent != null) {
        vector.add(new ASN1Integer(publicExponent));
    }
    return new DERSequence(vector);
}
 
开发者ID:xipki,项目名称:xitk,代码行数:12,代码来源:Asn1GenRSAKeypairParams.java

示例6: parseOtherName

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
private static Pair<String, String> parseOtherName(byte[] otherName) {
	try {
		ASN1Primitive asn1Primitive = ASN1Primitive.fromByteArray(otherName);
		if (asn1Primitive instanceof DERTaggedObject) {
			ASN1Primitive inner = ((DERTaggedObject) asn1Primitive).getObject();
			if (inner instanceof DLSequence) {
				DLSequence sequence = (DLSequence) inner;
				if (sequence.size() >= 2 && sequence.getObjectAt(1) instanceof DERTaggedObject) {
					String oid = sequence.getObjectAt(0).toString();
					ASN1Primitive value = ((DERTaggedObject) sequence.getObjectAt(1)).getObject();
					if (value instanceof DERUTF8String) {
						return new Pair<>(oid, ((DERUTF8String) value).getString());
					} else if (value instanceof DERIA5String) {
						return new Pair<>(oid, ((DERIA5String) value).getString());
					}
				}
			}
		}
		return null;
	} catch (IOException e) {
		return null;
	}
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:24,代码来源:XmppDomainVerifier.java

示例7: checkConstruction

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
private void checkConstruction(
    ContentHints hints,
    ASN1ObjectIdentifier contentType,
    DERUTF8String description)
    throws IOException
{
    checkValues(hints, contentType, description);

    hints = ContentHints.getInstance(hints);

    checkValues(hints, contentType, description);

    ASN1InputStream aIn = new ASN1InputStream(hints.toASN1Primitive().getEncoded());

    ASN1Sequence seq = (ASN1Sequence)aIn.readObject();

    hints = ContentHints.getInstance(seq);

    checkValues(hints, contentType, description);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:21,代码来源:ContentHintsUnitTest.java

示例8: parseOtherName

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
private static OtherName parseOtherName(byte[] otherName) {
    try {
        ASN1Primitive asn1Primitive = ASN1Primitive.fromByteArray(otherName);
        if (asn1Primitive instanceof DERTaggedObject) {
            ASN1Primitive inner = ((DERTaggedObject) asn1Primitive).getObject();
            if (inner instanceof DLSequence) {
                DLSequence sequence = (DLSequence) inner;
                if (sequence.size() >= 2 && sequence.getObjectAt(1) instanceof DERTaggedObject) {
                    String oid = sequence.getObjectAt(0).toString();
                    ASN1Primitive value = ((DERTaggedObject) sequence.getObjectAt(1)).getObject();
                    if (value instanceof DERUTF8String) {
                        return new OtherName(oid, ((DERUTF8String) value).getString());
                    } else if (value instanceof DERIA5String) {
                        return new OtherName(oid, ((DERIA5String) value).getString());
                    }
                }
            }
        }
        return null;
    } catch (IOException e) {
        return null;
    }
}
 
开发者ID:iNPUTmice,项目名称:ComplianceTester,代码行数:24,代码来源:XmppDomainVerifier.java

示例9: verifyCertificateCommonName

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
static void verifyCertificateCommonName(X500Name subject, String commonName) {
    List<AttributeTypeAndValue> attributesAndValues = Arrays.stream(subject.getRDNs())
            .flatMap(rdn -> rdn.isMultiValued() ?
                    Stream.of(rdn.getTypesAndValues()) : Stream.of(rdn.getFirst()))
            .filter(attr -> attr.getType() == BCStyle.CN)
            .collect(Collectors.toList());

    if (attributesAndValues.size() != 1) {
        throw new IllegalArgumentException("Only 1 common name should be set");
    }

    String actualCommonName = DERUTF8String.getInstance(attributesAndValues.get(0).getValue()).getString();
    if (! actualCommonName.equals(commonName)) {
        throw new IllegalArgumentException("Expected common name to be " + commonName + ", but was " + actualCommonName);
    }
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:17,代码来源:CertificateSigner.java

示例10: CertificateTrustBlock

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
CertificateTrustBlock(byte[] encoded)
{
    ASN1Sequence seq = ASN1Sequence.getInstance(encoded);

    for (Enumeration en = seq.getObjects(); en.hasMoreElements();)
    {
        ASN1Encodable obj = (ASN1Encodable)en.nextElement();

        if (obj instanceof ASN1Sequence)
        {
            this.uses = ASN1Sequence.getInstance(obj);
        }
        else if (obj instanceof ASN1TaggedObject)
        {
            this.prohibitions = ASN1Sequence.getInstance((ASN1TaggedObject)obj, false);
        }
        else if (obj instanceof DERUTF8String)
        {
            this.alias = DERUTF8String.getInstance(obj).getString();
        }
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:23,代码来源:CertificateTrustBlock.java

示例11: toASN1Sequence

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
ASN1Sequence toASN1Sequence()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    if (uses != null)
    {
       v.add(uses);
    }
    if (prohibitions != null)
    {
        v.add(new DERTaggedObject(false, 0, prohibitions));
    }
    if (alias != null)
    {
        v.add(new DERUTF8String(alias));
    }

    return new DERSequence(v);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:20,代码来源:CertificateTrustBlock.java

示例12: populateTextField

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
private static void populateTextField(Attribute[] attrs, JTextField textField, ASN1ObjectIdentifier pkcs9Attr) {
	if (attrs != null) {
		for (Attribute attribute : attrs) {

			ASN1ObjectIdentifier attributeOid = attribute.getAttrType();

			if (attributeOid.equals(pkcs9Attr)) {
				ASN1Encodable challenge = attribute.getAttributeValues()[0];

				// data type can be one of IA5String or UTF8String
				if (challenge instanceof DERPrintableString) {
					textField.setText(((DERPrintableString) challenge).getString());
				} else if (challenge instanceof DERUTF8String) {
					textField.setText(((DERUTF8String) challenge).getString());
				}
				textField.setCaretPosition(0);
			}
		}
	}
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:21,代码来源:DialogHelper.java

示例13: parseOtherName

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
private static Pair<String, String> parseOtherName(byte[] otherName) {
    try {
        ASN1Primitive asn1Primitive = ASN1Primitive.fromByteArray(otherName);
        if (asn1Primitive instanceof DERTaggedObject) {
            ASN1Primitive inner = ((DERTaggedObject) asn1Primitive).getObject();
            if (inner instanceof DLSequence) {
                DLSequence sequence = (DLSequence) inner;
                if (sequence.size() >= 2 && sequence.getObjectAt(1) instanceof DERTaggedObject) {
                    String oid = sequence.getObjectAt(0).toString();
                    ASN1Primitive value = ((DERTaggedObject) sequence.getObjectAt(1)).getObject();
                    if (value instanceof DERUTF8String) {
                        return new Pair<>(oid, ((DERUTF8String) value).getString());
                    } else if (value instanceof DERIA5String) {
                        return new Pair<>(oid, ((DERIA5String) value).getString());
                    }
                }
            }
        }
        return null;
    } catch (IOException e) {
        return null;
    }
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:24,代码来源:XmppDomainVerifier.java

示例14: toASN1Primitive

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
ASN1Primitive toASN1Primitive(boolean includeChecksum) {

        DEROctetString checksumEncodable = includeChecksum
                ? new DEROctetString(checksum())
                : null;

        ASN1Integer flagsEncodable = flags.map(ASN1Integer::new)
                .orElse(null);

        ASN1EncodableVector vector = DER.vector(
                new DERUTF8String(name),
                DER.toSet(keys),
                DER.toSet(serviceKeyIDs),
                checksumEncodable,
                flagsEncodable,
                signatureInfo.orElse(null));

        DERSequence sequence = new DERSequence(vector);
        return DER.toApplicationSpecific(APPLICATION_TAG, sequence);
    }
 
开发者ID:horrorho,项目名称:InflatableDonkey,代码行数:21,代码来源:KeySet.java

示例15: toASN1Primitive

import org.bouncycastle.asn1.DERUTF8String; //导入依赖的package包/类
@Override
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(new DERUTF8String(boardName));
    v.add(new DERUTF8String(host));
    v.add(new ASN1Integer(messageCount));

    if (backupHost != null)
    {
        v.add(new DERUTF8String(backupHost));
    }

    return new DERSequence(v);
}
 
开发者ID:cwgit,项目名称:ximix,代码行数:17,代码来源:BoardDetailMessage.java


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