Method: Ccrypto::Java::X509Engine#to_cert_subject

Defined in:
lib/ccrypto/java/engines/x509_engine.rb

#to_cert_subject(cp) ⇒ Object



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/ccrypto/java/engines/x509_engine.rb', line 523

def to_cert_subject(cp)

  builder = org.bouncycastle.asn1.x500.X500NameBuilder.new
  builder.addRDN(org.bouncycastle.asn1.x500.style::BCStyle::CN, cp.owner_name)

  builder.addRDN(org.bouncycastle.asn1.x500.style::BCStyle::O, cp.org) if not_empty?(cp.org)

  cp.org_unit.each do |ou|
    builder.addRDN(org.bouncycastle.asn1.x500.style::BCStyle::OU, ou) if not_empty?(ou)
  end

  #e = cp.email.first
  #if not_empty?(e)
  #  builder.addRDN(org.bouncycastle.asn1.x500.style::BCStyle::EmailAddress, e) 
  #end

  builder.build

end