code: public static String getChallengePassword(final PKCS10CertificationRequest csr) {
          Attribute[] attrs = csr.getAttributes();
          for (Attribute attr : attrs) {
              if (attr.getAttrType().equals(
                      PKCSObjectIdentifiers.pkcs_9_at_challengePassword)) {
                  // According to RFC 2985 this may be any of the DirectoryString
                  // types, but we can be more flexible and allow any ASN.1
                  // string.
                  ASN1String challengePassword = (ASN1String) attr
                          .getAttrValues().getObjectAt(0);
                  return challengePassword.getString();
              }
          }
          return null;
      }
docs: Extracts the <tt>Challenge password</tt> from the provided CSR.
  <p>
  
  @param csr
  the CSR to extract from.
  @return the extracted <tt>Challenge password</tt>