Search in sources :

Example 1 with SignerInfoWithPkey

use of org.jruby.ext.openssl.impl.SignerInfoWithPkey in project jruby-openssl by jruby.

the class PKCS7 method signers.

/**
 * ossl_pkcs7_get_signer
 *
 * This seems to return a list of SignerInfo objects.
 */
@JRubyMethod
public IRubyObject signers() {
    Collection<SignerInfoWithPkey> signerInfos = p7.getSignerInfo();
    RubyArray ary = getRuntime().newArray(signerInfos.size());
    for (SignerInfoWithPkey signerInfo : signerInfos) {
        ary.append(SignerInfo.create(getRuntime(), signerInfo));
    }
    return ary;
}
Also used : SignerInfoWithPkey(org.jruby.ext.openssl.impl.SignerInfoWithPkey) RubyArray(org.jruby.RubyArray) JRubyMethod(org.jruby.anno.JRubyMethod)

Example 2 with SignerInfoWithPkey

use of org.jruby.ext.openssl.impl.SignerInfoWithPkey in project jruby-openssl by jruby.

the class PKCS7 method add_signer.

@JRubyMethod
public IRubyObject add_signer(IRubyObject obj) {
    SignerInfoWithPkey signedInfo = ((SignerInfo) obj).getSignerInfo().dup();
    try {
        p7.addSigner(signedInfo);
    } catch (PKCS7Exception e) {
        throw newPKCS7Error(getRuntime(), e);
    }
    if (p7.isSigned()) {
        ASN1Encodable objectId = org.jruby.ext.openssl.impl.PKCS7.OID_pkcs7_data;
        signedInfo.addSignedAttribute(ASN1Registry.NID_pkcs9_contentType, objectId);
    }
    return this;
}
Also used : SignerInfoWithPkey(org.jruby.ext.openssl.impl.SignerInfoWithPkey) ASN1Encodable(org.bouncycastle.asn1.ASN1Encodable) PKCS7Exception(org.jruby.ext.openssl.impl.PKCS7Exception) NotVerifiedPKCS7Exception(org.jruby.ext.openssl.impl.NotVerifiedPKCS7Exception) JRubyMethod(org.jruby.anno.JRubyMethod)

Aggregations

JRubyMethod (org.jruby.anno.JRubyMethod)2 SignerInfoWithPkey (org.jruby.ext.openssl.impl.SignerInfoWithPkey)2 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)1 RubyArray (org.jruby.RubyArray)1 NotVerifiedPKCS7Exception (org.jruby.ext.openssl.impl.NotVerifiedPKCS7Exception)1 PKCS7Exception (org.jruby.ext.openssl.impl.PKCS7Exception)1