Package com.maverick.crypto.asn1

Examples of com.maverick.crypto.asn1.DERUTF8String


      do {
        av = getReq().getRegInfo(i);
        if (av != null) {
          if (StringUtils.equals(CRMFObjectIdentifiers.regCtrl_regToken.getId(), av.getObjectId().getId())) {
            final DEREncodable enc = av.getParameters();
            final DERUTF8String str = DERUTF8String.getInstance(enc);
            ret = str.getString();
            if (log.isDebugEnabled()) {
              log.debug("Found a request password in CRMF request regCtrl_regToken");
            }
          }
        }
        i++;
      } while ( (av != null) && (ret == null) );
    }   
    if (ret == null) {
      // If there is "Registration Token Control" in the CertRequest controls containing a password, we can use that
      // Note, this is the correct way to use the regToken according to RFC4211, section "6.1.  Registration Token Control"
      AttributeTypeAndValue av = null;
      int i = 0;
      do {
        av = getReq().getCertReq().getControls(i);
        if (av != null) {
          if (StringUtils.equals(CRMFObjectIdentifiers.regCtrl_regToken.getId(), av.getObjectId().getId())) {
            final DEREncodable enc = av.getParameters();
            final DERUTF8String str = DERUTF8String.getInstance(enc);
            ret = str.getString();
            if (log.isDebugEnabled()) {
              log.debug("Found a request password in CRMF request regCtrl_regToken");
            }
          }
        }
View Full Code Here


          }
        // Create a failure message
        PKIStatusInfo myPKIStatusInfo = new PKIStatusInfo(new DERInteger(2)); // 2 = rejection
        myPKIStatusInfo.setFailInfo(failInfo.getAsBitString());
        if (failText != null) {
          myPKIStatusInfo.setStatusString(new PKIFreeText(new DERUTF8String(failText)));         
        }
        PKIBody myPKIBody = CmpMessageHelper.createCertRequestRejectBody(myPKIHeader, myPKIStatusInfo, requestId, requestType);
        PKIMessage myPKIMessage = new PKIMessage(myPKIHeader, myPKIBody);
       
        if ( (pbeKeyId != null) && (pbeKey != null) && (pbeDigestAlg != null) && (pbeMacAlg != null) ) {
          responseMessage = CmpMessageHelper.protectPKIMessageWithPBE(myPKIMessage, pbeKeyId, pbeKey, pbeDigestAlg, pbeMacAlg, pbeIterationCount);
        } else {
          responseMessage = CmpMessageHelper.signPKIMessage(myPKIMessage, (X509Certificate)signCert, signKey, digestAlg, provider);
        }
        ret = true
      } else {
          if (log.isDebugEnabled()) {
            log.debug("Creating a 'waiting' message?");
          }
        // Not supported, lets create a PKIError failure instead
        // Create a failure message
        PKIStatusInfo myPKIStatusInfo = new PKIStatusInfo(new DERInteger(2)); // 2 = rejection
        myPKIStatusInfo.setFailInfo(failInfo.getAsBitString());
        if (failText != null) {
          myPKIStatusInfo.setStatusString(new PKIFreeText(new DERUTF8String(failText)));         
        }
        ErrorMsgContent myErrorContent = new ErrorMsgContent(myPKIStatusInfo);
        PKIBody myPKIBody = new PKIBody(myErrorContent, 23); // 23 = error
        PKIMessage myPKIMessage = new PKIMessage(myPKIHeader, myPKIBody);
        if ( (pbeKeyId != null) && (pbeKey != null) && (pbeDigestAlg != null) && (pbeMacAlg != null) ) {
View Full Code Here

    //   -- This certificate, according to Act. No. xxxx Electronic Signature Law is a qualified electronic certificate
    //
    // YourCustomUTF8String ::= UTF8String
    if (certProfile.getUseQCCustomString() &&
        !StringUtils.isEmpty(certProfile.getQCCustomStringOid()) && !StringUtils.isEmpty(certProfile.getQCCustomStringText())) {
      final DERUTF8String str = new DERUTF8String(certProfile.getQCCustomStringText());
      final DERObjectIdentifier oid = new DERObjectIdentifier(certProfile.getQCCustomStringOid());
      qc = new QCStatement(oid, str);
      qcs.add(qc);                
    }
    if (!qcs.isEmpty()) {
View Full Code Here

                new DERT61String("hello world"),
                new DERTaggedObject(0, new DERPrintableString("hello world")),
                new DERUniversalString(data),
                new DERUnknownTag(0xff & (~(DERTags.TAGGED | DERTags.APPLICATION)), data),
                new DERUTCTime(new Date()),
                new DERUTF8String("hello world"),
                new DERVisibleString("hello world")
            };
       
        try
        {
View Full Code Here

      switch (type) {
         case CONTENT_TYPE_IA5STRING:
            contents = (DERString)new DERIA5String (text);
            break;
         case CONTENT_TYPE_UTF8STRING:
            contents = (DERString)new DERUTF8String(text);
            break;
         case CONTENT_TYPE_VISIBLESTRING:
            contents = (DERString)new DERVisibleString(text);
            break;
         case CONTENT_TYPE_BMPSTRING:
            contents = (DERString)new DERBMPString(text);
            break;
         default:
            contents = (DERString)new DERUTF8String(text);
            break;
      }
   }
View Full Code Here

      }
     
      if (canBeUTF8(text))
      {
          contentType = CONTENT_TYPE_UTF8STRING;
          contents = new DERUTF8String(text);
      }
      else
      {
          contentType = CONTENT_TYPE_BMPSTRING;
          contents = new DERBMPString(text);
View Full Code Here

                            Log.debug("CertificateManager: Ignoring non-XMPP otherName, " + objectId.getId());
                            continue;
                        }

                        // Get identity string
                        DERUTF8String derStr = DERUTF8String.getInstance(otherNameSeq.getObjectAt(1));
                        String identity = derStr.getString();
                        if (identity != null && identity.length() > 0) {
                            // Add the decoded server name to the list of identities
                            identities.add(identity);
                        }
                    }
View Full Code Here

        certGenerator.setSignatureAlgorithm(signAlgoritm);

        // Generate the subject alternative name
        boolean critical = subjectDN == null || "".equals(subjectDN.trim());
        DERSequence othernameSequence = new DERSequence(new ASN1Encodable[]{
                new DERObjectIdentifier("1.3.6.1.5.5.7.8.5"), new DERTaggedObject(true, 0, new DERUTF8String(domain))});
        GeneralName othernameGN = new GeneralName(GeneralName.otherName, othernameSequence);
        GeneralNames subjectAltNames = new GeneralNames(new DERSequence(new ASN1Encodable[]{othernameGN}));
        // Add subject alternative name extension
        certGenerator.addExtension(X509Extensions.SubjectAlternativeName, critical, subjectAltNames);
View Full Code Here

      {
         case CONTENT_TYPE_IA5STRING:
            contents = (DERString)new DERIA5String (text);
            break;
         case CONTENT_TYPE_UTF8STRING:
            contents = (DERString)new DERUTF8String(text);
            break;
         case CONTENT_TYPE_VISIBLESTRING:
            contents = (DERString)new DERVisibleString(text);
            break;
         case CONTENT_TYPE_BMPSTRING:
            contents = (DERString)new DERBMPString(text);
            break;
         default:
            contents = (DERString)new DERUTF8String(text);
            break;
      }
   }
View Full Code Here

      }
     
      if (canBeUTF8(text))
      {
          contentType = CONTENT_TYPE_UTF8STRING;
          contents = new DERUTF8String(text);
      }
      else
      {
          contentType = CONTENT_TYPE_BMPSTRING;
          contents = new DERBMPString(text);
View Full Code Here

TOP

Related Classes of com.maverick.crypto.asn1.DERUTF8String

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.