Ejemplo n.º 1
0
def load_pkcs7(p7file):
    bio = m2.bio_new_file(p7file, 'r')
    if bio is None:
        raise BIO.BIOError(Err.get_error())

    try:
        p7_ptr = m2.pkcs7_read_bio(bio)
    finally:
        m2.bio_free(bio)

    if p7_ptr is None:
        raise PKCS7_Error(Err.get_error())
    return PKCS7(p7_ptr, 1)
Ejemplo n.º 2
0
def load_pkcs7(p7file):
    bio = m2.bio_new_file(p7file, 'r')
    if bio is None:
        raise BIO.BIOError(Err.get_error())

    try:
        p7_ptr = m2.pkcs7_read_bio(bio)
    finally:
        m2.bio_free(bio)

    if p7_ptr is None:
        raise PKCS7_Error(Err.get_error())
    return PKCS7(p7_ptr, 1)
Ejemplo n.º 3
0
def load_pkcs7_bio(p7_bio):
    # type: (BIO.BIO) -> PKCS7
    p7_ptr = m2.pkcs7_read_bio(p7_bio._ptr())
    return PKCS7(p7_ptr, 1)
Ejemplo n.º 4
0
def load_pkcs7(p7file):
    # type: (AnyStr) -> PKCS7
    with BIO.openfile(p7file, 'r') as bio:
        p7_ptr = m2.pkcs7_read_bio(bio.bio)

    return PKCS7(p7_ptr, 1)
Ejemplo n.º 5
0
def load_pkcs7_bio(p7_bio):
    # type: (BIO.BIO) -> PKCS7
    p7_ptr = m2.pkcs7_read_bio(p7_bio._ptr())
    if p7_ptr is None:
        raise PKCS7_Error(Err.get_error())
    return PKCS7(p7_ptr, 1)
Ejemplo n.º 6
0
def load_pkcs7_bio(p7_bio):
    p7_ptr = m2.pkcs7_read_bio(p7_bio._ptr())
    if p7_ptr is None:
        raise PKCS7_Error(Err.get_error())
    return PKCS7(p7_ptr, 1)
Ejemplo n.º 7
0
def load_pkcs7_bio(p7_bio):
    # type: (BIO.BIO) -> PKCS7
    p7_ptr = m2.pkcs7_read_bio(p7_bio._ptr())
    return PKCS7(p7_ptr, 1)
Ejemplo n.º 8
0
def load_pkcs7(p7file):
    # type: (AnyStr) -> PKCS7
    with BIO.openfile(p7file, 'r') as bio:
        p7_ptr = m2.pkcs7_read_bio(bio.bio)

    return PKCS7(p7_ptr, 1)