partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
_bcrypt_sign
Generates an RSA, DSA or ECDSA signature via CNG :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode string of "md5", "sha1", "sha256", "sha384", "sha512" or "raw" :para...
oscrypto/_win/asymmetric.py
def _bcrypt_sign(private_key, data, hash_algorithm, rsa_pss_padding=False): """ Generates an RSA, DSA or ECDSA signature via CNG :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: ...
def _bcrypt_sign(private_key, data, hash_algorithm, rsa_pss_padding=False): """ Generates an RSA, DSA or ECDSA signature via CNG :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: ...
[ "Generates", "an", "RSA", "DSA", "or", "ECDSA", "signature", "via", "CNG" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L2827-L2942
[ "def", "_bcrypt_sign", "(", "private_key", ",", "data", ",", "hash_algorithm", ",", "rsa_pss_padding", "=", "False", ")", ":", "if", "hash_algorithm", "==", "'raw'", ":", "digest", "=", "data", "else", ":", "hash_constant", "=", "{", "'md5'", ":", "BcryptCon...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_encrypt
Encrypts a value using an RSA public key :param certificate_or_public_key: A Certificate or PublicKey instance to encrypt with :param data: A byte string of the data to encrypt :param rsa_oaep_padding: If OAEP padding should be used instead of PKCS#1 v1.5 :raises: Val...
oscrypto/_win/asymmetric.py
def _encrypt(certificate_or_public_key, data, rsa_oaep_padding=False): """ Encrypts a value using an RSA public key :param certificate_or_public_key: A Certificate or PublicKey instance to encrypt with :param data: A byte string of the data to encrypt :param rsa_oaep_padding: ...
def _encrypt(certificate_or_public_key, data, rsa_oaep_padding=False): """ Encrypts a value using an RSA public key :param certificate_or_public_key: A Certificate or PublicKey instance to encrypt with :param data: A byte string of the data to encrypt :param rsa_oaep_padding: ...
[ "Encrypts", "a", "value", "using", "an", "RSA", "public", "key" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L2945-L2994
[ "def", "_encrypt", "(", "certificate_or_public_key", ",", "data", ",", "rsa_oaep_padding", "=", "False", ")", ":", "if", "not", "isinstance", "(", "certificate_or_public_key", ",", "(", "Certificate", ",", "PublicKey", ")", ")", ":", "raise", "TypeError", "(", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_advapi32_encrypt
Encrypts a value using an RSA public key via CryptoAPI :param certificate_or_public_key: A Certificate or PublicKey instance to encrypt with :param data: A byte string of the data to encrypt :param rsa_oaep_padding: If OAEP padding should be used instead of PKCS#1 v1.5 :raise...
oscrypto/_win/asymmetric.py
def _advapi32_encrypt(certificate_or_public_key, data, rsa_oaep_padding=False): """ Encrypts a value using an RSA public key via CryptoAPI :param certificate_or_public_key: A Certificate or PublicKey instance to encrypt with :param data: A byte string of the data to encrypt :param...
def _advapi32_encrypt(certificate_or_public_key, data, rsa_oaep_padding=False): """ Encrypts a value using an RSA public key via CryptoAPI :param certificate_or_public_key: A Certificate or PublicKey instance to encrypt with :param data: A byte string of the data to encrypt :param...
[ "Encrypts", "a", "value", "using", "an", "RSA", "public", "key", "via", "CryptoAPI" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L2997-L3051
[ "def", "_advapi32_encrypt", "(", "certificate_or_public_key", ",", "data", ",", "rsa_oaep_padding", "=", "False", ")", ":", "flags", "=", "0", "if", "rsa_oaep_padding", ":", "flags", "=", "Advapi32Const", ".", "CRYPT_OAEP", "out_len", "=", "new", "(", "advapi32"...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_bcrypt_encrypt
Encrypts a value using an RSA public key via CNG :param certificate_or_public_key: A Certificate or PublicKey instance to encrypt with :param data: A byte string of the data to encrypt :param rsa_oaep_padding: If OAEP padding should be used instead of PKCS#1 v1.5 :raises: ...
oscrypto/_win/asymmetric.py
def _bcrypt_encrypt(certificate_or_public_key, data, rsa_oaep_padding=False): """ Encrypts a value using an RSA public key via CNG :param certificate_or_public_key: A Certificate or PublicKey instance to encrypt with :param data: A byte string of the data to encrypt :param rsa_oae...
def _bcrypt_encrypt(certificate_or_public_key, data, rsa_oaep_padding=False): """ Encrypts a value using an RSA public key via CNG :param certificate_or_public_key: A Certificate or PublicKey instance to encrypt with :param data: A byte string of the data to encrypt :param rsa_oae...
[ "Encrypts", "a", "value", "using", "an", "RSA", "public", "key", "via", "CNG" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L3054-L3123
[ "def", "_bcrypt_encrypt", "(", "certificate_or_public_key", ",", "data", ",", "rsa_oaep_padding", "=", "False", ")", ":", "flags", "=", "BcryptConst", ".", "BCRYPT_PAD_PKCS1", "if", "rsa_oaep_padding", "is", "True", ":", "flags", "=", "BcryptConst", ".", "BCRYPT_P...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_decrypt
Encrypts a value using an RSA private key :param private_key: A PrivateKey instance to decrypt with :param ciphertext: A byte string of the data to decrypt :param rsa_oaep_padding: If OAEP padding should be used instead of PKCS#1 v1.5 :raises: ValueError - when any of...
oscrypto/_win/asymmetric.py
def _decrypt(private_key, ciphertext, rsa_oaep_padding=False): """ Encrypts a value using an RSA private key :param private_key: A PrivateKey instance to decrypt with :param ciphertext: A byte string of the data to decrypt :param rsa_oaep_padding: If OAEP padding should be...
def _decrypt(private_key, ciphertext, rsa_oaep_padding=False): """ Encrypts a value using an RSA private key :param private_key: A PrivateKey instance to decrypt with :param ciphertext: A byte string of the data to decrypt :param rsa_oaep_padding: If OAEP padding should be...
[ "Encrypts", "a", "value", "using", "an", "RSA", "private", "key" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L3126-L3174
[ "def", "_decrypt", "(", "private_key", ",", "ciphertext", ",", "rsa_oaep_padding", "=", "False", ")", ":", "if", "not", "isinstance", "(", "private_key", ",", "PrivateKey", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n private_key m...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_advapi32_decrypt
Encrypts a value using an RSA private key via CryptoAPI :param private_key: A PrivateKey instance to decrypt with :param ciphertext: A byte string of the data to decrypt :param rsa_oaep_padding: If OAEP padding should be used instead of PKCS#1 v1.5 :raises: ValueError...
oscrypto/_win/asymmetric.py
def _advapi32_decrypt(private_key, ciphertext, rsa_oaep_padding=False): """ Encrypts a value using an RSA private key via CryptoAPI :param private_key: A PrivateKey instance to decrypt with :param ciphertext: A byte string of the data to decrypt :param rsa_oaep_padding: If...
def _advapi32_decrypt(private_key, ciphertext, rsa_oaep_padding=False): """ Encrypts a value using an RSA private key via CryptoAPI :param private_key: A PrivateKey instance to decrypt with :param ciphertext: A byte string of the data to decrypt :param rsa_oaep_padding: If...
[ "Encrypts", "a", "value", "using", "an", "RSA", "private", "key", "via", "CryptoAPI" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L3177-L3217
[ "def", "_advapi32_decrypt", "(", "private_key", ",", "ciphertext", ",", "rsa_oaep_padding", "=", "False", ")", ":", "flags", "=", "0", "if", "rsa_oaep_padding", ":", "flags", "=", "Advapi32Const", ".", "CRYPT_OAEP", "ciphertext", "=", "ciphertext", "[", ":", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
Certificate.self_signed
:return: A boolean - if the certificate is self-signed
oscrypto/_win/asymmetric.py
def self_signed(self): """ :return: A boolean - if the certificate is self-signed """ if self._self_signed is None: self._self_signed = False if self.asn1.self_signed in set(['yes', 'maybe']): signature_algo = self.asn1['signature_alg...
def self_signed(self): """ :return: A boolean - if the certificate is self-signed """ if self._self_signed is None: self._self_signed = False if self.asn1.self_signed in set(['yes', 'maybe']): signature_algo = self.asn1['signature_alg...
[ ":", "return", ":", "A", "boolean", "-", "if", "the", "certificate", "is", "self", "-", "signed" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/asymmetric.py#L505-L544
[ "def", "self_signed", "(", "self", ")", ":", "if", "self", ".", "_self_signed", "is", "None", ":", "self", ".", "_self_signed", "=", "False", "if", "self", ".", "asn1", ".", "self_signed", "in", "set", "(", "[", "'yes'", ",", "'maybe'", "]", ")", ":"...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSession._obtain_credentials
Obtains a credentials handle from secur32.dll for use with SChannel
oscrypto/_win/tls.py
def _obtain_credentials(self): """ Obtains a credentials handle from secur32.dll for use with SChannel """ protocol_values = { 'SSLv3': Secur32Const.SP_PROT_SSL3_CLIENT, 'TLSv1': Secur32Const.SP_PROT_TLS1_CLIENT, 'TLSv1.1': Secur32Const.SP_PROT_TLS1_1...
def _obtain_credentials(self): """ Obtains a credentials handle from secur32.dll for use with SChannel """ protocol_values = { 'SSLv3': Secur32Const.SP_PROT_SSL3_CLIENT, 'TLSv1': Secur32Const.SP_PROT_TLS1_CLIENT, 'TLSv1.1': Secur32Const.SP_PROT_TLS1_1...
[ "Obtains", "a", "credentials", "handle", "from", "secur32", ".", "dll", "for", "use", "with", "SChannel" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L200-L279
[ "def", "_obtain_credentials", "(", "self", ")", ":", "protocol_values", "=", "{", "'SSLv3'", ":", "Secur32Const", ".", "SP_PROT_SSL3_CLIENT", ",", "'TLSv1'", ":", "Secur32Const", ".", "SP_PROT_TLS1_CLIENT", ",", "'TLSv1.1'", ":", "Secur32Const", ".", "SP_PROT_TLS1_1...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.wrap
Takes an existing socket and adds TLS :param socket: A socket.socket object to wrap with TLS :param hostname: A unicode string of the hostname or IP the socket is connected to :param session: An existing TLSSession object to allow for session reuse, specifi...
oscrypto/_win/tls.py
def wrap(cls, socket, hostname, session=None): """ Takes an existing socket and adds TLS :param socket: A socket.socket object to wrap with TLS :param hostname: A unicode string of the hostname or IP the socket is connected to :param session: ...
def wrap(cls, socket, hostname, session=None): """ Takes an existing socket and adds TLS :param socket: A socket.socket object to wrap with TLS :param hostname: A unicode string of the hostname or IP the socket is connected to :param session: ...
[ "Takes", "an", "existing", "socket", "and", "adds", "TLS" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L327-L387
[ "def", "wrap", "(", "cls", ",", "socket", ",", "hostname", ",", "session", "=", "None", ")", ":", "if", "not", "isinstance", "(", "socket", ",", "socket_", ".", "socket", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n soc...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._create_buffers
Creates a SecBufferDesc struct and contained SecBuffer structs :param number: The number of contains SecBuffer objects to create :return: A tuple of (SecBufferDesc pointer, SecBuffer array)
oscrypto/_win/tls.py
def _create_buffers(self, number): """ Creates a SecBufferDesc struct and contained SecBuffer structs :param number: The number of contains SecBuffer objects to create :return: A tuple of (SecBufferDesc pointer, SecBuffer array) """ buffers = ne...
def _create_buffers(self, number): """ Creates a SecBufferDesc struct and contained SecBuffer structs :param number: The number of contains SecBuffer objects to create :return: A tuple of (SecBufferDesc pointer, SecBuffer array) """ buffers = ne...
[ "Creates", "a", "SecBufferDesc", "struct", "and", "contained", "SecBuffer", "structs" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L476-L501
[ "def", "_create_buffers", "(", "self", ",", "number", ")", ":", "buffers", "=", "new", "(", "secur32", ",", "'SecBuffer[%d]'", "%", "number", ")", "for", "index", "in", "range", "(", "0", ",", "number", ")", ":", "buffers", "[", "index", "]", ".", "c...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._extra_trust_root_validation
Manually invoked windows certificate chain builder and verification step when there are extra trust roots to include in the search process
oscrypto/_win/tls.py
def _extra_trust_root_validation(self): """ Manually invoked windows certificate chain builder and verification step when there are extra trust roots to include in the search process """ store = None cert_chain_context_pointer = None try: # We set up...
def _extra_trust_root_validation(self): """ Manually invoked windows certificate chain builder and verification step when there are extra trust roots to include in the search process """ store = None cert_chain_context_pointer = None try: # We set up...
[ "Manually", "invoked", "windows", "certificate", "chain", "builder", "and", "verification", "step", "when", "there", "are", "extra", "trust", "roots", "to", "include", "in", "the", "search", "process" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L503-L679
[ "def", "_extra_trust_root_validation", "(", "self", ")", ":", "store", "=", "None", "cert_chain_context_pointer", "=", "None", "try", ":", "# We set up an in-memory store to pass as an extra store to grab", "# certificates from when performing the verification", "store", "=", "cr...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._handshake
Perform an initial TLS handshake, or a renegotiation :param renegotiate: If the handshake is for a renegotiation
oscrypto/_win/tls.py
def _handshake(self, renegotiate=False): """ Perform an initial TLS handshake, or a renegotiation :param renegotiate: If the handshake is for a renegotiation """ in_buffers = None out_buffers = None new_context_handle_pointer = None try: ...
def _handshake(self, renegotiate=False): """ Perform an initial TLS handshake, or a renegotiation :param renegotiate: If the handshake is for a renegotiation """ in_buffers = None out_buffers = None new_context_handle_pointer = None try: ...
[ "Perform", "an", "initial", "TLS", "handshake", "or", "a", "renegotiation" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L681-L981
[ "def", "_handshake", "(", "self", ",", "renegotiate", "=", "False", ")", ":", "in_buffers", "=", "None", "out_buffers", "=", "None", "new_context_handle_pointer", "=", "None", "try", ":", "if", "renegotiate", ":", "temp_context_handle_pointer", "=", "self", ".",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.read
Reads data from the TLS-wrapped socket :param max_length: The number of bytes to read :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs ValueError - when any of the parameters contain a...
oscrypto/_win/tls.py
def read(self, max_length): """ Reads data from the TLS-wrapped socket :param max_length: The number of bytes to read :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs V...
def read(self, max_length): """ Reads data from the TLS-wrapped socket :param max_length: The number of bytes to read :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs V...
[ "Reads", "data", "from", "the", "TLS", "-", "wrapped", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L983-L1151
[ "def", "read", "(", "self", ",", "max_length", ")", ":", "if", "not", "isinstance", "(", "max_length", ",", "int_types", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n max_length must be an integer, not %s\n '''", ",", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.select_read
Blocks until the socket is ready to be read from, or the timeout is hit :param timeout: A float - the period of time to wait for data to be read. None for no time limit. :return: A boolean - if data is ready to be read. Will only be False if timeout is n...
oscrypto/_win/tls.py
def select_read(self, timeout=None): """ Blocks until the socket is ready to be read from, or the timeout is hit :param timeout: A float - the period of time to wait for data to be read. None for no time limit. :return: A boolean - if data is ready t...
def select_read(self, timeout=None): """ Blocks until the socket is ready to be read from, or the timeout is hit :param timeout: A float - the period of time to wait for data to be read. None for no time limit. :return: A boolean - if data is ready t...
[ "Blocks", "until", "the", "socket", "is", "ready", "to", "be", "read", "from", "or", "the", "timeout", "is", "hit" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L1153-L1171
[ "def", "select_read", "(", "self", ",", "timeout", "=", "None", ")", ":", "# If we have buffered data, we consider a read possible", "if", "len", "(", "self", ".", "_decrypted_bytes", ")", ">", "0", ":", "return", "True", "read_ready", ",", "_", ",", "_", "=",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.read_exactly
Reads exactly the specified number of bytes from the socket :param num_bytes: An integer - the exact number of bytes to read :return: A byte string of the data that was read
oscrypto/_win/tls.py
def read_exactly(self, num_bytes): """ Reads exactly the specified number of bytes from the socket :param num_bytes: An integer - the exact number of bytes to read :return: A byte string of the data that was read """ output = b'' remaini...
def read_exactly(self, num_bytes): """ Reads exactly the specified number of bytes from the socket :param num_bytes: An integer - the exact number of bytes to read :return: A byte string of the data that was read """ output = b'' remaini...
[ "Reads", "exactly", "the", "specified", "number", "of", "bytes", "from", "the", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L1239-L1256
[ "def", "read_exactly", "(", "self", ",", "num_bytes", ")", ":", "output", "=", "b''", "remaining", "=", "num_bytes", "while", "remaining", ">", "0", ":", "output", "+=", "self", ".", "read", "(", "remaining", ")", "remaining", "=", "num_bytes", "-", "len...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.write
Writes data to the TLS-wrapped socket :param data: A byte string to write to the socket :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs ValueError - when any of the parameters contain...
oscrypto/_win/tls.py
def write(self, data): """ Writes data to the TLS-wrapped socket :param data: A byte string to write to the socket :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs Valu...
def write(self, data): """ Writes data to the TLS-wrapped socket :param data: A byte string to write to the socket :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs Valu...
[ "Writes", "data", "to", "the", "TLS", "-", "wrapped", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L1258-L1318
[ "def", "write", "(", "self", ",", "data", ")", ":", "if", "self", ".", "_context_handle_pointer", "is", "None", ":", "self", ".", "_raise_closed", "(", ")", "if", "not", "self", ".", "_encrypt_data_buffer", ":", "self", ".", "_encrypt_data_buffer", "=", "b...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.select_write
Blocks until the socket is ready to be written to, or the timeout is hit :param timeout: A float - the period of time to wait for the socket to be ready to written to. None for no time limit. :return: A boolean - if the socket is ready for writing. Will only be Fals...
oscrypto/_win/tls.py
def select_write(self, timeout=None): """ Blocks until the socket is ready to be written to, or the timeout is hit :param timeout: A float - the period of time to wait for the socket to be ready to written to. None for no time limit. :return: A boole...
def select_write(self, timeout=None): """ Blocks until the socket is ready to be written to, or the timeout is hit :param timeout: A float - the period of time to wait for the socket to be ready to written to. None for no time limit. :return: A boole...
[ "Blocks", "until", "the", "socket", "is", "ready", "to", "be", "written", "to", "or", "the", "timeout", "is", "hit" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L1320-L1334
[ "def", "select_write", "(", "self", ",", "timeout", "=", "None", ")", ":", "_", ",", "write_ready", ",", "_", "=", "select", ".", "select", "(", "[", "]", ",", "[", "self", ".", "_socket", "]", ",", "[", "]", ",", "timeout", ")", "return", "len",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.shutdown
Shuts down the TLS session and then shuts down the underlying socket :raises: OSError - when an error is returned by the OS crypto library
oscrypto/_win/tls.py
def shutdown(self): """ Shuts down the TLS session and then shuts down the underlying socket :raises: OSError - when an error is returned by the OS crypto library """ if self._context_handle_pointer is None: return out_buffers = None try...
def shutdown(self): """ Shuts down the TLS session and then shuts down the underlying socket :raises: OSError - when an error is returned by the OS crypto library """ if self._context_handle_pointer is None: return out_buffers = None try...
[ "Shuts", "down", "the", "TLS", "session", "and", "then", "shuts", "down", "the", "underlying", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L1336-L1418
[ "def", "shutdown", "(", "self", ")", ":", "if", "self", ".", "_context_handle_pointer", "is", "None", ":", "return", "out_buffers", "=", "None", "try", ":", "# ApplyControlToken fails with SEC_E_UNSUPPORTED_FUNCTION", "# when called on Windows 7", "if", "_win_version_info...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.close
Shuts down the TLS session and socket and forcibly closes it
oscrypto/_win/tls.py
def close(self): """ Shuts down the TLS session and socket and forcibly closes it """ try: self.shutdown() finally: if self._socket: try: self._socket.close() except (socket_.error): ...
def close(self): """ Shuts down the TLS session and socket and forcibly closes it """ try: self.shutdown() finally: if self._socket: try: self._socket.close() except (socket_.error): ...
[ "Shuts", "down", "the", "TLS", "session", "and", "socket", "and", "forcibly", "closes", "it" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L1420-L1434
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "shutdown", "(", ")", "finally", ":", "if", "self", ".", "_socket", ":", "try", ":", "self", ".", "_socket", ".", "close", "(", ")", "except", "(", "socket_", ".", "error", ")", ":",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._read_certificates
Reads end-entity and intermediate certificate information from the TLS session
oscrypto/_win/tls.py
def _read_certificates(self): """ Reads end-entity and intermediate certificate information from the TLS session """ cert_context_pointer_pointer = new(crypt32, 'CERT_CONTEXT **') result = secur32.QueryContextAttributesW( self._context_handle_pointer, ...
def _read_certificates(self): """ Reads end-entity and intermediate certificate information from the TLS session """ cert_context_pointer_pointer = new(crypt32, 'CERT_CONTEXT **') result = secur32.QueryContextAttributesW( self._context_handle_pointer, ...
[ "Reads", "end", "-", "entity", "and", "intermediate", "certificate", "information", "from", "the", "TLS", "session" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L1436-L1474
[ "def", "_read_certificates", "(", "self", ")", ":", "cert_context_pointer_pointer", "=", "new", "(", "crypt32", ",", "'CERT_CONTEXT **'", ")", "result", "=", "secur32", ".", "QueryContextAttributesW", "(", "self", ".", "_context_handle_pointer", ",", "Secur32Const", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.certificate
An asn1crypto.x509.Certificate object of the end-entity certificate presented by the server
oscrypto/_win/tls.py
def certificate(self): """ An asn1crypto.x509.Certificate object of the end-entity certificate presented by the server """ if self._context_handle_pointer is None: self._raise_closed() if self._certificate is None: self._read_certificates() ...
def certificate(self): """ An asn1crypto.x509.Certificate object of the end-entity certificate presented by the server """ if self._context_handle_pointer is None: self._raise_closed() if self._certificate is None: self._read_certificates() ...
[ "An", "asn1crypto", ".", "x509", ".", "Certificate", "object", "of", "the", "end", "-", "entity", "certificate", "presented", "by", "the", "server" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L1488-L1500
[ "def", "certificate", "(", "self", ")", ":", "if", "self", ".", "_context_handle_pointer", "is", "None", ":", "self", ".", "_raise_closed", "(", ")", "if", "self", ".", "_certificate", "is", "None", ":", "self", ".", "_read_certificates", "(", ")", "return...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.intermediates
A list of asn1crypto.x509.Certificate objects that were presented as intermediates by the server
oscrypto/_win/tls.py
def intermediates(self): """ A list of asn1crypto.x509.Certificate objects that were presented as intermediates by the server """ if self._context_handle_pointer is None: self._raise_closed() if self._certificate is None: self._read_certificates(...
def intermediates(self): """ A list of asn1crypto.x509.Certificate objects that were presented as intermediates by the server """ if self._context_handle_pointer is None: self._raise_closed() if self._certificate is None: self._read_certificates(...
[ "A", "list", "of", "asn1crypto", ".", "x509", ".", "Certificate", "objects", "that", "were", "presented", "as", "intermediates", "by", "the", "server" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/tls.py#L1503-L1515
[ "def", "intermediates", "(", "self", ")", ":", "if", "self", ".", "_context_handle_pointer", "is", "None", ":", "self", ".", "_raise_closed", "(", ")", "if", "self", ".", "_certificate", "is", "None", ":", "self", ".", "_read_certificates", "(", ")", "retu...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
handle_cf_error
Checks a CFErrorRef and throws an exception if there is an error to report :param error_pointer: A CFErrorRef :raises: OSError - when the CFErrorRef contains an error
oscrypto/_osx/_core_foundation.py
def handle_cf_error(error_pointer): """ Checks a CFErrorRef and throws an exception if there is an error to report :param error_pointer: A CFErrorRef :raises: OSError - when the CFErrorRef contains an error """ if is_null(error_pointer): return error = unwrap(erro...
def handle_cf_error(error_pointer): """ Checks a CFErrorRef and throws an exception if there is an error to report :param error_pointer: A CFErrorRef :raises: OSError - when the CFErrorRef contains an error """ if is_null(error_pointer): return error = unwrap(erro...
[ "Checks", "a", "CFErrorRef", "and", "throws", "an", "exception", "if", "there", "is", "an", "error", "to", "report" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation.py#L19-L209
[ "def", "handle_cf_error", "(", "error_pointer", ")", ":", "if", "is_null", "(", "error_pointer", ")", ":", "return", "error", "=", "unwrap", "(", "error_pointer", ")", "if", "is_null", "(", "error", ")", ":", "return", "cf_string_domain", "=", "CoreFoundation"...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.wrap
Takes an existing socket and adds TLS :param socket: A socket.socket object to wrap with TLS :param hostname: A unicode string of the hostname or IP the socket is connected to :param session: An existing TLSSession object to allow for session reuse, specifi...
oscrypto/_openssl/tls.py
def wrap(cls, socket, hostname, session=None): """ Takes an existing socket and adds TLS :param socket: A socket.socket object to wrap with TLS :param hostname: A unicode string of the hostname or IP the socket is connected to :param session: ...
def wrap(cls, socket, hostname, session=None): """ Takes an existing socket and adds TLS :param socket: A socket.socket object to wrap with TLS :param hostname: A unicode string of the hostname or IP the socket is connected to :param session: ...
[ "Takes", "an", "existing", "socket", "and", "adds", "TLS" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/tls.py#L320-L369
[ "def", "wrap", "(", "cls", ",", "socket", ",", "hostname", ",", "session", "=", "None", ")", ":", "if", "not", "isinstance", "(", "socket", ",", "socket_", ".", "socket", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n soc...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._handshake
Perform an initial TLS handshake
oscrypto/_openssl/tls.py
def _handshake(self): """ Perform an initial TLS handshake """ self._ssl = None self._rbio = None self._wbio = None try: self._ssl = libssl.SSL_new(self._session._ssl_ctx) if is_null(self._ssl): self._ssl = None ...
def _handshake(self): """ Perform an initial TLS handshake """ self._ssl = None self._rbio = None self._wbio = None try: self._ssl = libssl.SSL_new(self._session._ssl_ctx) if is_null(self._ssl): self._ssl = None ...
[ "Perform", "an", "initial", "TLS", "handshake" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/tls.py#L438-L673
[ "def", "_handshake", "(", "self", ")", ":", "self", ".", "_ssl", "=", "None", "self", ".", "_rbio", "=", "None", "self", ".", "_wbio", "=", "None", "try", ":", "self", ".", "_ssl", "=", "libssl", ".", "SSL_new", "(", "self", ".", "_session", ".", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._raw_read
Reads data from the socket and writes it to the memory bio used by libssl to decrypt the data. Returns the unencrypted data for the purpose of debugging handshakes. :return: A byte string of ciphertext from the socket. Used for debugging the handshake only.
oscrypto/_openssl/tls.py
def _raw_read(self): """ Reads data from the socket and writes it to the memory bio used by libssl to decrypt the data. Returns the unencrypted data for the purpose of debugging handshakes. :return: A byte string of ciphertext from the socket. Used for de...
def _raw_read(self): """ Reads data from the socket and writes it to the memory bio used by libssl to decrypt the data. Returns the unencrypted data for the purpose of debugging handshakes. :return: A byte string of ciphertext from the socket. Used for de...
[ "Reads", "data", "from", "the", "socket", "and", "writes", "it", "to", "the", "memory", "bio", "used", "by", "libssl", "to", "decrypt", "the", "data", ".", "Returns", "the", "unencrypted", "data", "for", "the", "purpose", "of", "debugging", "handshakes", "...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/tls.py#L675-L694
[ "def", "_raw_read", "(", "self", ")", ":", "data", "=", "self", ".", "_raw_bytes", "try", ":", "data", "+=", "self", ".", "_socket", ".", "recv", "(", "8192", ")", "except", "(", "socket_", ".", "error", ")", ":", "pass", "output", "=", "data", "wr...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._raw_write
Takes ciphertext from the memory bio and writes it to the socket. :return: A byte string of ciphertext going to the socket. Used for debugging the handshake only.
oscrypto/_openssl/tls.py
def _raw_write(self): """ Takes ciphertext from the memory bio and writes it to the socket. :return: A byte string of ciphertext going to the socket. Used for debugging the handshake only. """ data_available = libssl.BIO_ctrl_pending(self._wbio) ...
def _raw_write(self): """ Takes ciphertext from the memory bio and writes it to the socket. :return: A byte string of ciphertext going to the socket. Used for debugging the handshake only. """ data_available = libssl.BIO_ctrl_pending(self._wbio) ...
[ "Takes", "ciphertext", "from", "the", "memory", "bio", "and", "writes", "it", "to", "the", "socket", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/tls.py#L696-L729
[ "def", "_raw_write", "(", "self", ")", ":", "data_available", "=", "libssl", ".", "BIO_ctrl_pending", "(", "self", ".", "_wbio", ")", "if", "data_available", "==", "0", ":", "return", "b''", "to_read", "=", "min", "(", "self", ".", "_buffer_size", ",", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.read
Reads data from the TLS-wrapped socket :param max_length: The number of bytes to read - output may be less than this :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs ValueError - when ...
oscrypto/_openssl/tls.py
def read(self, max_length): """ Reads data from the TLS-wrapped socket :param max_length: The number of bytes to read - output may be less than this :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-rel...
def read(self, max_length): """ Reads data from the TLS-wrapped socket :param max_length: The number of bytes to read - output may be less than this :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-rel...
[ "Reads", "data", "from", "the", "TLS", "-", "wrapped", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/tls.py#L731-L816
[ "def", "read", "(", "self", ",", "max_length", ")", ":", "if", "not", "isinstance", "(", "max_length", ",", "int_types", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n max_length must be an integer, not %s\n '''", ",", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.write
Writes data to the TLS-wrapped socket :param data: A byte string to write to the socket :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs ValueError - when any of the parameters contain...
oscrypto/_openssl/tls.py
def write(self, data): """ Writes data to the TLS-wrapped socket :param data: A byte string to write to the socket :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs Valu...
def write(self, data): """ Writes data to the TLS-wrapped socket :param data: A byte string to write to the socket :raises: socket.socket - when a non-TLS socket error occurs oscrypto.errors.TLSError - when a TLS-related error occurs Valu...
[ "Writes", "data", "to", "the", "TLS", "-", "wrapped", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/tls.py#L926-L968
[ "def", "write", "(", "self", ",", "data", ")", ":", "data_len", "=", "len", "(", "data", ")", "while", "data_len", ":", "if", "self", ".", "_ssl", "is", "None", ":", "self", ".", "_raise_closed", "(", ")", "result", "=", "libssl", ".", "SSL_write", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._shutdown
Shuts down the TLS session and then shuts down the underlying socket :param manual: A boolean if the connection was manually shutdown
oscrypto/_openssl/tls.py
def _shutdown(self, manual): """ Shuts down the TLS session and then shuts down the underlying socket :param manual: A boolean if the connection was manually shutdown """ if self._ssl is None: return while True: result = libssl.SSL_s...
def _shutdown(self, manual): """ Shuts down the TLS session and then shuts down the underlying socket :param manual: A boolean if the connection was manually shutdown """ if self._ssl is None: return while True: result = libssl.SSL_s...
[ "Shuts", "down", "the", "TLS", "session", "and", "then", "shuts", "down", "the", "underlying", "socket" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/tls.py#L986-L1035
[ "def", "_shutdown", "(", "self", ",", "manual", ")", ":", "if", "self", ".", "_ssl", "is", "None", ":", "return", "while", "True", ":", "result", "=", "libssl", ".", "SSL_shutdown", "(", "self", ".", "_ssl", ")", "# Don't be noisy if the socket is already cl...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket._read_certificates
Reads end-entity and intermediate certificate information from the TLS session
oscrypto/_openssl/tls.py
def _read_certificates(self): """ Reads end-entity and intermediate certificate information from the TLS session """ stack_pointer = libssl.SSL_get_peer_cert_chain(self._ssl) if is_null(stack_pointer): handle_openssl_error(0, TLSError) if libcrypto_v...
def _read_certificates(self): """ Reads end-entity and intermediate certificate information from the TLS session """ stack_pointer = libssl.SSL_get_peer_cert_chain(self._ssl) if is_null(stack_pointer): handle_openssl_error(0, TLSError) if libcrypto_v...
[ "Reads", "end", "-", "entity", "and", "intermediate", "certificate", "information", "from", "the", "TLS", "session" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/tls.py#L1060-L1094
[ "def", "_read_certificates", "(", "self", ")", ":", "stack_pointer", "=", "libssl", ".", "SSL_get_peer_cert_chain", "(", "self", ".", "_ssl", ")", "if", "is_null", "(", "stack_pointer", ")", ":", "handle_openssl_error", "(", "0", ",", "TLSError", ")", "if", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.certificate
An asn1crypto.x509.Certificate object of the end-entity certificate presented by the server
oscrypto/_openssl/tls.py
def certificate(self): """ An asn1crypto.x509.Certificate object of the end-entity certificate presented by the server """ if self._ssl is None: self._raise_closed() if self._certificate is None: self._read_certificates() return self._ce...
def certificate(self): """ An asn1crypto.x509.Certificate object of the end-entity certificate presented by the server """ if self._ssl is None: self._raise_closed() if self._certificate is None: self._read_certificates() return self._ce...
[ "An", "asn1crypto", ".", "x509", ".", "Certificate", "object", "of", "the", "end", "-", "entity", "certificate", "presented", "by", "the", "server" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/tls.py#L1110-L1122
[ "def", "certificate", "(", "self", ")", ":", "if", "self", ".", "_ssl", "is", "None", ":", "self", ".", "_raise_closed", "(", ")", "if", "self", ".", "_certificate", "is", "None", ":", "self", ".", "_read_certificates", "(", ")", "return", "self", ".",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
TLSSocket.intermediates
A list of asn1crypto.x509.Certificate objects that were presented as intermediates by the server
oscrypto/_openssl/tls.py
def intermediates(self): """ A list of asn1crypto.x509.Certificate objects that were presented as intermediates by the server """ if self._ssl is None: self._raise_closed() if self._certificate is None: self._read_certificates() return s...
def intermediates(self): """ A list of asn1crypto.x509.Certificate objects that were presented as intermediates by the server """ if self._ssl is None: self._raise_closed() if self._certificate is None: self._read_certificates() return s...
[ "A", "list", "of", "asn1crypto", ".", "x509", ".", "Certificate", "objects", "that", "were", "presented", "as", "intermediates", "by", "the", "server" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/tls.py#L1125-L1137
[ "def", "intermediates", "(", "self", ")", ":", "if", "self", ".", "_ssl", "is", "None", ":", "self", ".", "_raise_closed", "(", ")", "if", "self", ".", "_certificate", "is", "None", ":", "self", ".", "_read_certificates", "(", ")", "return", "self", "....
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
aes_cbc_no_padding_encrypt
Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and no padding. This means the ciphertext must be an exact multiple of 16 bytes long. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The plaintext - a byte string :p...
oscrypto/_win/symmetric.py
def aes_cbc_no_padding_encrypt(key, data, iv): """ Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and no padding. This means the ciphertext must be an exact multiple of 16 bytes long. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long ...
def aes_cbc_no_padding_encrypt(key, data, iv): """ Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and no padding. This means the ciphertext must be an exact multiple of 16 bytes long. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long ...
[ "Encrypts", "plaintext", "using", "AES", "in", "CBC", "mode", "with", "a", "128", "192", "or", "256", "bit", "key", "and", "no", "padding", ".", "This", "means", "the", "ciphertext", "must", "be", "an", "exact", "multiple", "of", "16", "bytes", "long", ...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L45-L97
[ "def", "aes_cbc_no_padding_encrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "not", "in", "[", "16", ",", "24", ",", "32", "]", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be either...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
aes_cbc_no_padding_decrypt
Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key and no padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: The initialization vector - a byte string 16-bytes long ...
oscrypto/_win/symmetric.py
def aes_cbc_no_padding_decrypt(key, data, iv): """ Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key and no padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: T...
def aes_cbc_no_padding_decrypt(key, data, iv): """ Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key and no padding. :param key: The encryption key - a byte string either 16, 24 or 32 bytes long :param data: The ciphertext - a byte string :param iv: T...
[ "Decrypts", "AES", "ciphertext", "in", "CBC", "mode", "using", "a", "128", "192", "or", "256", "bit", "key", "and", "no", "padding", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L100-L140
[ "def", "aes_cbc_no_padding_decrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "not", "in", "[", "16", ",", "24", ",", "32", "]", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be either...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
tripledes_cbc_pkcs5_encrypt
Encrypts plaintext using 3DES in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The plaintext - a byte string :param iv: The 8-byte initialization vector to use - a byte string - set as None to gener...
oscrypto/_win/symmetric.py
def tripledes_cbc_pkcs5_encrypt(key, data, iv): """ Encrypts plaintext using 3DES in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The plaintext - a byte string :param iv: The 8-byte initialization ...
def tripledes_cbc_pkcs5_encrypt(key, data, iv): """ Encrypts plaintext using 3DES in either 2 or 3 key mode :param key: The encryption key - a byte string 16 or 24 bytes long (2 or 3 key mode) :param data: The plaintext - a byte string :param iv: The 8-byte initialization ...
[ "Encrypts", "plaintext", "using", "3DES", "in", "either", "2", "or", "3", "key", "mode" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L376-L421
[ "def", "tripledes_cbc_pkcs5_encrypt", "(", "key", ",", "data", ",", "iv", ")", ":", "if", "len", "(", "key", ")", "!=", "16", "and", "len", "(", "key", ")", "!=", "24", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n key must be 1...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_advapi32_create_handles
Creates an HCRYPTPROV and HCRYPTKEY for symmetric encryption/decryption. The HCRYPTPROV must be released by close_context_handle() and the HCRYPTKEY must be released by advapi32.CryptDestroyKey() when done. :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", ...
oscrypto/_win/symmetric.py
def _advapi32_create_handles(cipher, key, iv): """ Creates an HCRYPTPROV and HCRYPTKEY for symmetric encryption/decryption. The HCRYPTPROV must be released by close_context_handle() and the HCRYPTKEY must be released by advapi32.CryptDestroyKey() when done. :param cipher: A unicode string o...
def _advapi32_create_handles(cipher, key, iv): """ Creates an HCRYPTPROV and HCRYPTKEY for symmetric encryption/decryption. The HCRYPTPROV must be released by close_context_handle() and the HCRYPTKEY must be released by advapi32.CryptDestroyKey() when done. :param cipher: A unicode string o...
[ "Creates", "an", "HCRYPTPROV", "and", "HCRYPTKEY", "for", "symmetric", "encryption", "/", "decryption", ".", "The", "HCRYPTPROV", "must", "be", "released", "by", "close_context_handle", "()", "and", "the", "HCRYPTKEY", "must", "be", "released", "by", "advapi32", ...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L556-L664
[ "def", "_advapi32_create_handles", "(", "cipher", ",", "key", ",", "iv", ")", ":", "context_handle", "=", "None", "if", "cipher", "==", "'aes'", ":", "algorithm_id", "=", "{", "16", ":", "Advapi32Const", ".", "CALG_AES_128", ",", "24", ":", "Advapi32Const", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_bcrypt_create_key_handle
Creates a BCRYPT_KEY_HANDLE for symmetric encryption/decryption. The handle must be released by bcrypt.BCryptDestroyKey() when done. :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: A byte string of the symmetric key ...
oscrypto/_win/symmetric.py
def _bcrypt_create_key_handle(cipher, key): """ Creates a BCRYPT_KEY_HANDLE for symmetric encryption/decryption. The handle must be released by bcrypt.BCryptDestroyKey() when done. :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :pa...
def _bcrypt_create_key_handle(cipher, key): """ Creates a BCRYPT_KEY_HANDLE for symmetric encryption/decryption. The handle must be released by bcrypt.BCryptDestroyKey() when done. :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :pa...
[ "Creates", "a", "BCRYPT_KEY_HANDLE", "for", "symmetric", "encryption", "/", "decryption", ".", "The", "handle", "must", "be", "released", "by", "bcrypt", ".", "BCryptDestroyKey", "()", "when", "done", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L667-L735
[ "def", "_bcrypt_create_key_handle", "(", "cipher", ",", "key", ")", ":", "alg_handle", "=", "None", "alg_constant", "=", "{", "'aes'", ":", "BcryptConst", ".", "BCRYPT_AES_ALGORITHM", ",", "'des'", ":", "BcryptConst", ".", "BCRYPT_DES_ALGORITHM", ",", "'tripledes_...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_encrypt
Encrypts plaintext :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :param iv: The initialization vector ...
oscrypto/_win/symmetric.py
def _encrypt(cipher, key, data, iv, padding): """ Encrypts plaintext :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte...
def _encrypt(cipher, key, data, iv, padding): """ Encrypts plaintext :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte...
[ "Encrypts", "plaintext" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L738-L796
[ "def", "_encrypt", "(", "cipher", ",", "key", ",", "data", ",", "iv", ",", "padding", ")", ":", "if", "not", "isinstance", "(", "key", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n key must be a byte string, not...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_advapi32_encrypt
Encrypts plaintext via CryptoAPI :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :param iv: The initiali...
oscrypto/_win/symmetric.py
def _advapi32_encrypt(cipher, key, data, iv, padding): """ Encrypts plaintext via CryptoAPI :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: ...
def _advapi32_encrypt(cipher, key, data, iv, padding): """ Encrypts plaintext via CryptoAPI :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: ...
[ "Encrypts", "plaintext", "via", "CryptoAPI" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L799-L877
[ "def", "_advapi32_encrypt", "(", "cipher", ",", "key", ",", "data", ",", "iv", ",", "padding", ")", ":", "context_handle", "=", "None", "key_handle", "=", "None", "try", ":", "context_handle", ",", "key_handle", "=", "_advapi32_create_handles", "(", "cipher", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_bcrypt_encrypt
Encrypts plaintext via CNG :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: The plaintext - a byte string :param iv: The initialization...
oscrypto/_win/symmetric.py
def _bcrypt_encrypt(cipher, key, data, iv, padding): """ Encrypts plaintext via CNG :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: The pla...
def _bcrypt_encrypt(cipher, key, data, iv, padding): """ Encrypts plaintext via CNG :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: The pla...
[ "Encrypts", "plaintext", "via", "CNG" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L880-L960
[ "def", "_bcrypt_encrypt", "(", "cipher", ",", "key", ",", "data", ",", "iv", ",", "padding", ")", ":", "key_handle", "=", "None", "try", ":", "key_handle", "=", "_bcrypt_create_key_handle", "(", "cipher", ",", "key", ")", "if", "iv", "is", "None", ":", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_decrypt
Decrypts AES/RC4/RC2/3DES/DES ciphertext :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: The ciphertext - a byte string :param iv: The...
oscrypto/_win/symmetric.py
def _decrypt(cipher, key, data, iv, padding): """ Decrypts AES/RC4/RC2/3DES/DES ciphertext :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: ...
def _decrypt(cipher, key, data, iv, padding): """ Decrypts AES/RC4/RC2/3DES/DES ciphertext :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: ...
[ "Decrypts", "AES", "/", "RC4", "/", "RC2", "/", "3DES", "/", "DES", "ciphertext" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L963-L1021
[ "def", "_decrypt", "(", "cipher", ",", "key", ",", "data", ",", "iv", ",", "padding", ")", ":", "if", "not", "isinstance", "(", "key", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n key must be a byte string, not...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_advapi32_decrypt
Decrypts AES/RC4/RC2/3DES/DES ciphertext via CryptoAPI :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long :param data: The ciphertext - a byte string :param i...
oscrypto/_win/symmetric.py
def _advapi32_decrypt(cipher, key, data, iv, padding): """ Decrypts AES/RC4/RC2/3DES/DES ciphertext via CryptoAPI :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long ...
def _advapi32_decrypt(cipher, key, data, iv, padding): """ Decrypts AES/RC4/RC2/3DES/DES ciphertext via CryptoAPI :param cipher: A unicode string of "aes", "des", "tripledes_2key", "tripledes_3key", "rc2", "rc4" :param key: The encryption key - a byte string 5-16 bytes long ...
[ "Decrypts", "AES", "/", "RC4", "/", "RC2", "/", "3DES", "/", "DES", "ciphertext", "via", "CryptoAPI" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/symmetric.py#L1024-L1082
[ "def", "_advapi32_decrypt", "(", "cipher", ",", "key", ",", "data", ",", "iv", ",", "padding", ")", ":", "context_handle", "=", "None", "key_handle", "=", "None", "try", ":", "context_handle", ",", "key_handle", "=", "_advapi32_create_handles", "(", "cipher", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
handle_error
Extracts the last Windows error message into a python unicode string :param error_num: The number to get the error string for :return: A unicode string error message
oscrypto/_win/_cng.py
def handle_error(error_num): """ Extracts the last Windows error message into a python unicode string :param error_num: The number to get the error string for :return: A unicode string error message """ if error_num == 0: return messages = { BcryptConst.ST...
def handle_error(error_num): """ Extracts the last Windows error message into a python unicode string :param error_num: The number to get the error string for :return: A unicode string error message """ if error_num == 0: return messages = { BcryptConst.ST...
[ "Extracts", "the", "last", "Windows", "error", "message", "into", "a", "python", "unicode", "string" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/_cng.py#L34-L66
[ "def", "handle_error", "(", "error_num", ")", ":", "if", "error_num", "==", "0", ":", "return", "messages", "=", "{", "BcryptConst", ".", "STATUS_NOT_FOUND", ":", "'The object was not found'", ",", "BcryptConst", ".", "STATUS_INVALID_PARAMETER", ":", "'An invalid pa...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
handle_openssl_error
Checks if an error occured, and if so throws an OSError containing the last OpenSSL error message :param result: An integer result code - 1 or greater indicates success :param exception_class: The exception class to use for the exception if an error occurred :raises: OSError -...
oscrypto/_openssl/_libcrypto.py
def handle_openssl_error(result, exception_class=None): """ Checks if an error occured, and if so throws an OSError containing the last OpenSSL error message :param result: An integer result code - 1 or greater indicates success :param exception_class: The exception class to use fo...
def handle_openssl_error(result, exception_class=None): """ Checks if an error occured, and if so throws an OSError containing the last OpenSSL error message :param result: An integer result code - 1 or greater indicates success :param exception_class: The exception class to use fo...
[ "Checks", "if", "an", "error", "occured", "and", "if", "so", "throws", "an", "OSError", "containing", "the", "last", "OpenSSL", "error", "message" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/_libcrypto.py#L57-L85
[ "def", "handle_openssl_error", "(", "result", ",", "exception_class", "=", "None", ")", ":", "if", "result", ">", "0", ":", "return", "if", "exception_class", "is", "None", ":", "exception_class", "=", "OSError", "error_num", "=", "libcrypto", ".", "ERR_get_er...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
peek_openssl_error
Peeks into the error stack and pulls out the lib, func and reason :return: A three-element tuple of integers (lib, func, reason)
oscrypto/_openssl/_libcrypto.py
def peek_openssl_error(): """ Peeks into the error stack and pulls out the lib, func and reason :return: A three-element tuple of integers (lib, func, reason) """ error = libcrypto.ERR_peek_error() lib = int((error >> 24) & 0xff) func = int((error >> 12) & 0xfff) reason = int(e...
def peek_openssl_error(): """ Peeks into the error stack and pulls out the lib, func and reason :return: A three-element tuple of integers (lib, func, reason) """ error = libcrypto.ERR_peek_error() lib = int((error >> 24) & 0xff) func = int((error >> 12) & 0xfff) reason = int(e...
[ "Peeks", "into", "the", "error", "stack", "and", "pulls", "out", "the", "lib", "func", "and", "reason" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/_libcrypto.py#L88-L101
[ "def", "peek_openssl_error", "(", ")", ":", "error", "=", "libcrypto", ".", "ERR_peek_error", "(", ")", "lib", "=", "int", "(", "(", "error", ">>", "24", ")", "&", "0xff", ")", "func", "=", "int", "(", "(", "error", ">>", "12", ")", "&", "0xfff", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_is_osx_107
:return: A bool if the current machine is running OS X 10.7
oscrypto/_pkcs1.py
def _is_osx_107(): """ :return: A bool if the current machine is running OS X 10.7 """ if sys.platform != 'darwin': return False version = platform.mac_ver()[0] return tuple(map(int, version.split('.')))[0:2] == (10, 7)
def _is_osx_107(): """ :return: A bool if the current machine is running OS X 10.7 """ if sys.platform != 'darwin': return False version = platform.mac_ver()[0] return tuple(map(int, version.split('.')))[0:2] == (10, 7)
[ ":", "return", ":", "A", "bool", "if", "the", "current", "machine", "is", "running", "OS", "X", "10", ".", "7" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_pkcs1.py#L44-L53
[ "def", "_is_osx_107", "(", ")", ":", "if", "sys", ".", "platform", "!=", "'darwin'", ":", "return", "False", "version", "=", "platform", ".", "mac_ver", "(", ")", "[", "0", "]", "return", "tuple", "(", "map", "(", "int", ",", "version", ".", "split",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
add_pss_padding
Pads a byte string using the EMSA-PSS-Encode operation described in PKCS#1 v2.2. :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param salt_length: The length of the salt as an integer - typically the same as the ...
oscrypto/_pkcs1.py
def add_pss_padding(hash_algorithm, salt_length, key_length, message): """ Pads a byte string using the EMSA-PSS-Encode operation described in PKCS#1 v2.2. :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param sal...
def add_pss_padding(hash_algorithm, salt_length, key_length, message): """ Pads a byte string using the EMSA-PSS-Encode operation described in PKCS#1 v2.2. :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param sal...
[ "Pads", "a", "byte", "string", "using", "the", "EMSA", "-", "PSS", "-", "Encode", "operation", "described", "in", "PKCS#1", "v2", ".", "2", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_pkcs1.py#L56-L179
[ "def", "add_pss_padding", "(", "hash_algorithm", ",", "salt_length", ",", "key_length", ",", "message", ")", ":", "if", "_backend", "!=", "'winlegacy'", "and", "sys", ".", "platform", "!=", "'darwin'", ":", "raise", "SystemError", "(", "pretty_message", "(", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
verify_pss_padding
Verifies the PSS padding on an encoded message :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param salt_length: The length of the salt as an integer - typically the same as the length of the output from the ...
oscrypto/_pkcs1.py
def verify_pss_padding(hash_algorithm, salt_length, key_length, message, signature): """ Verifies the PSS padding on an encoded message :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param salt_length: The le...
def verify_pss_padding(hash_algorithm, salt_length, key_length, message, signature): """ Verifies the PSS padding on an encoded message :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param salt_length: The le...
[ "Verifies", "the", "PSS", "padding", "on", "an", "encoded", "message" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_pkcs1.py#L182-L308
[ "def", "verify_pss_padding", "(", "hash_algorithm", ",", "salt_length", ",", "key_length", ",", "message", ",", "signature", ")", ":", "if", "_backend", "!=", "'winlegacy'", "and", "sys", ".", "platform", "!=", "'darwin'", ":", "raise", "SystemError", "(", "pr...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_mgf1
The PKCS#1 MGF1 mask generation algorithm :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param seed: A byte string to use as the seed for the mask :param mask_length: The desired mask length, as an integ...
oscrypto/_pkcs1.py
def _mgf1(hash_algorithm, seed, mask_length): """ The PKCS#1 MGF1 mask generation algorithm :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param seed: A byte string to use as the seed for the mask :param...
def _mgf1(hash_algorithm, seed, mask_length): """ The PKCS#1 MGF1 mask generation algorithm :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param seed: A byte string to use as the seed for the mask :param...
[ "The", "PKCS#1", "MGF1", "mask", "generation", "algorithm" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_pkcs1.py#L311-L381
[ "def", "_mgf1", "(", "hash_algorithm", ",", "seed", ",", "mask_length", ")", ":", "if", "not", "isinstance", "(", "seed", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n seed must be a byte string, not %s\n '''...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_add_pkcs1v15_padding
Adds PKCS#1 v1.5 padding to a message :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :param operation: A unicode string of "encrypting" or "signing" :return: The padded data as a byte string
oscrypto/_pkcs1.py
def _add_pkcs1v15_padding(key_length, data, operation): """ Adds PKCS#1 v1.5 padding to a message :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :param operation: A unicode string of "encrypting" or "signing" :retur...
def _add_pkcs1v15_padding(key_length, data, operation): """ Adds PKCS#1 v1.5 padding to a message :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :param operation: A unicode string of "encrypting" or "signing" :retur...
[ "Adds", "PKCS#1", "v1", ".", "5", "padding", "to", "a", "message" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_pkcs1.py#L461-L525
[ "def", "_add_pkcs1v15_padding", "(", "key_length", ",", "data", ",", "operation", ")", ":", "if", "operation", "==", "'encrypting'", ":", "second_byte", "=", "b'\\x02'", "else", ":", "second_byte", "=", "b'\\x01'", "if", "not", "isinstance", "(", "data", ",", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_remove_pkcs1v15_padding
Removes PKCS#1 v1.5 padding from a message using constant time operations :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :param operation: A unicode string of "decrypting" or "verifying" :return: The unpadded data a...
oscrypto/_pkcs1.py
def _remove_pkcs1v15_padding(key_length, data, operation): """ Removes PKCS#1 v1.5 padding from a message using constant time operations :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :param operation: A unicode string o...
def _remove_pkcs1v15_padding(key_length, data, operation): """ Removes PKCS#1 v1.5 padding from a message using constant time operations :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :param operation: A unicode string o...
[ "Removes", "PKCS#1", "v1", ".", "5", "padding", "from", "a", "message", "using", "constant", "time", "operations" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_pkcs1.py#L528-L616
[ "def", "_remove_pkcs1v15_padding", "(", "key_length", ",", "data", ",", "operation", ")", ":", "if", "operation", "==", "'decrypting'", ":", "second_byte", "=", "2", "else", ":", "second_byte", "=", "1", "if", "not", "isinstance", "(", "data", ",", "byte_cls...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
raw_rsa_private_crypt
Performs a raw RSA algorithm in a byte string using a private key. This is a low-level primitive and is prone to disastrous results if used incorrectly. :param private_key: An oscrypto.asymmetric.PrivateKey object :param data: A byte string of the plaintext to be signed or ciphertext t...
oscrypto/_pkcs1.py
def raw_rsa_private_crypt(private_key, data): """ Performs a raw RSA algorithm in a byte string using a private key. This is a low-level primitive and is prone to disastrous results if used incorrectly. :param private_key: An oscrypto.asymmetric.PrivateKey object :param data: A...
def raw_rsa_private_crypt(private_key, data): """ Performs a raw RSA algorithm in a byte string using a private key. This is a low-level primitive and is prone to disastrous results if used incorrectly. :param private_key: An oscrypto.asymmetric.PrivateKey object :param data: A...
[ "Performs", "a", "raw", "RSA", "algorithm", "in", "a", "byte", "string", "using", "a", "private", "key", ".", "This", "is", "a", "low", "-", "level", "primitive", "and", "is", "prone", "to", "disastrous", "results", "if", "used", "incorrectly", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_pkcs1.py#L619-L673
[ "def", "raw_rsa_private_crypt", "(", "private_key", ",", "data", ")", ":", "if", "_backend", "!=", "'winlegacy'", ":", "raise", "SystemError", "(", "'Pure-python RSA crypt is only for Windows XP/2003'", ")", "if", "not", "hasattr", "(", "private_key", ",", "'asn1'", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
raw_rsa_public_crypt
Performs a raw RSA algorithm in a byte string using a certificate or public key. This is a low-level primitive and is prone to disastrous results if used incorrectly. :param certificate_or_public_key: An oscrypto.asymmetric.PublicKey or oscrypto.asymmetric.Certificate object :param dat...
oscrypto/_pkcs1.py
def raw_rsa_public_crypt(certificate_or_public_key, data): """ Performs a raw RSA algorithm in a byte string using a certificate or public key. This is a low-level primitive and is prone to disastrous results if used incorrectly. :param certificate_or_public_key: An oscrypto.asymmetric.Publ...
def raw_rsa_public_crypt(certificate_or_public_key, data): """ Performs a raw RSA algorithm in a byte string using a certificate or public key. This is a low-level primitive and is prone to disastrous results if used incorrectly. :param certificate_or_public_key: An oscrypto.asymmetric.Publ...
[ "Performs", "a", "raw", "RSA", "algorithm", "in", "a", "byte", "string", "using", "a", "certificate", "or", "public", "key", ".", "This", "is", "a", "low", "-", "level", "primitive", "and", "is", "prone", "to", "disastrous", "results", "if", "used", "inc...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_pkcs1.py#L676-L737
[ "def", "raw_rsa_public_crypt", "(", "certificate_or_public_key", ",", "data", ")", ":", "if", "_backend", "!=", "'winlegacy'", ":", "raise", "SystemError", "(", "'Pure-python RSA crypt is only for Windows XP/2003'", ")", "has_asn1", "=", "hasattr", "(", "certificate_or_pu...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
pkcs12_kdf
KDF from RFC7292 appendix B.2 - https://tools.ietf.org/html/rfc7292#page-19 :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of the password to use an input to the KDF :param salt: ...
oscrypto/_openssl/util.py
def pkcs12_kdf(hash_algorithm, password, salt, iterations, key_length, id_): """ KDF from RFC7292 appendix B.2 - https://tools.ietf.org/html/rfc7292#page-19 :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param passwor...
def pkcs12_kdf(hash_algorithm, password, salt, iterations, key_length, id_): """ KDF from RFC7292 appendix B.2 - https://tools.ietf.org/html/rfc7292#page-19 :param hash_algorithm: The string name of the hash algorithm to use: "md5", "sha1", "sha224", "sha256", "sha384", "sha512" :param passwor...
[ "KDF", "from", "RFC7292", "appendix", "B", ".", "2", "-", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc7292#page", "-", "19" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_openssl/util.py#L123-L243
[ "def", "pkcs12_kdf", "(", "hash_algorithm", ",", "password", ",", "salt", ",", "iterations", ",", "key_length", ",", "id_", ")", ":", "if", "not", "isinstance", "(", "password", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
extract_from_system
Extracts trusted CA certificates from the OS X trusted root keychain. :param cert_callback: A callback that is called once for each certificate in the trust store. It should accept two parameters: an asn1crypto.x509.Certificate object, and a reason. The reason will be None if the certificat...
oscrypto/_osx/trust_list.py
def extract_from_system(cert_callback=None, callback_only_on_failure=False): """ Extracts trusted CA certificates from the OS X trusted root keychain. :param cert_callback: A callback that is called once for each certificate in the trust store. It should accept two parameters: an asn1crypto...
def extract_from_system(cert_callback=None, callback_only_on_failure=False): """ Extracts trusted CA certificates from the OS X trusted root keychain. :param cert_callback: A callback that is called once for each certificate in the trust store. It should accept two parameters: an asn1crypto...
[ "Extracts", "trusted", "CA", "certificates", "from", "the", "OS", "X", "trusted", "root", "keychain", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/trust_list.py#L27-L161
[ "def", "extract_from_system", "(", "cert_callback", "=", "None", ",", "callback_only_on_failure", "=", "False", ")", ":", "certs_pointer_pointer", "=", "new", "(", "CoreFoundation", ",", "'CFArrayRef *'", ")", "res", "=", "Security", ".", "SecTrustCopyAnchorCertificat...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_cert_callback
Constructs an asn1crypto.x509.Certificate object and calls the export callback :param callback: The callback to call :param der_cert: A byte string of the DER-encoded certificate :param reason: None if cert is being exported, or a unicode string of the reason it is not...
oscrypto/_osx/trust_list.py
def _cert_callback(callback, der_cert, reason): """ Constructs an asn1crypto.x509.Certificate object and calls the export callback :param callback: The callback to call :param der_cert: A byte string of the DER-encoded certificate :param reason: None if cert is being e...
def _cert_callback(callback, der_cert, reason): """ Constructs an asn1crypto.x509.Certificate object and calls the export callback :param callback: The callback to call :param der_cert: A byte string of the DER-encoded certificate :param reason: None if cert is being e...
[ "Constructs", "an", "asn1crypto", ".", "x509", ".", "Certificate", "object", "and", "calls", "the", "export", "callback" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/trust_list.py#L164-L182
[ "def", "_cert_callback", "(", "callback", ",", "der_cert", ",", "reason", ")", ":", "if", "not", "callback", ":", "return", "callback", "(", "x509", ".", "Certificate", ".", "load", "(", "der_cert", ")", ",", "reason", ")" ]
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_cert_details
Return the certificate and a hash of it :param cert_pointer: A SecCertificateRef :return: A 2-element tuple: - [0]: A byte string of the SHA1 hash of the cert - [1]: A byte string of the DER-encoded contents of the cert
oscrypto/_osx/trust_list.py
def _cert_details(cert_pointer): """ Return the certificate and a hash of it :param cert_pointer: A SecCertificateRef :return: A 2-element tuple: - [0]: A byte string of the SHA1 hash of the cert - [1]: A byte string of the DER-encoded contents of the cert """ ...
def _cert_details(cert_pointer): """ Return the certificate and a hash of it :param cert_pointer: A SecCertificateRef :return: A 2-element tuple: - [0]: A byte string of the SHA1 hash of the cert - [1]: A byte string of the DER-encoded contents of the cert """ ...
[ "Return", "the", "certificate", "and", "a", "hash", "of", "it" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/trust_list.py#L185-L209
[ "def", "_cert_details", "(", "cert_pointer", ")", ":", "data_pointer", "=", "None", "try", ":", "data_pointer", "=", "Security", ".", "SecCertificateCopyData", "(", "cert_pointer", ")", "der_cert", "=", "CFHelpers", ".", "cf_data_to_bytes", "(", "data_pointer", ")...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_extract_error
Extracts the last OS error message into a python unicode string :return: A unicode string error message
oscrypto/_osx/util.py
def _extract_error(): """ Extracts the last OS error message into a python unicode string :return: A unicode string error message """ error_num = errno() try: error_string = os.strerror(error_num) except (ValueError): return str_cls(error_num) if isinstance(er...
def _extract_error(): """ Extracts the last OS error message into a python unicode string :return: A unicode string error message """ error_num = errno() try: error_string = os.strerror(error_num) except (ValueError): return str_cls(error_num) if isinstance(er...
[ "Extracts", "the", "last", "OS", "error", "message", "into", "a", "python", "unicode", "string" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/util.py#L42-L60
[ "def", "_extract_error", "(", ")", ":", "error_num", "=", "errno", "(", ")", "try", ":", "error_string", "=", "os", ".", "strerror", "(", "error_num", ")", "except", "(", "ValueError", ")", ":", "return", "str_cls", "(", "error_num", ")", "if", "isinstan...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
pbkdf2
PBKDF2 from PKCS#5 :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of the password to use an input to the KDF :param salt: A cryptographic random byte string :param iterations: ...
oscrypto/_osx/util.py
def pbkdf2(hash_algorithm, password, salt, iterations, key_length): """ PBKDF2 from PKCS#5 :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of the password to use an input to the KDF ...
def pbkdf2(hash_algorithm, password, salt, iterations, key_length): """ PBKDF2 from PKCS#5 :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param password: A byte string of the password to use an input to the KDF ...
[ "PBKDF2", "from", "PKCS#5" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/util.py#L63-L161
[ "def", "pbkdf2", "(", "hash_algorithm", ",", "password", ",", "salt", ",", "iterations", ",", "key_length", ")", ":", "if", "not", "isinstance", "(", "password", ",", "byte_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n pas...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
rand_bytes
Returns a number of random bytes suitable for cryptographic purposes :param length: The desired number of bytes :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type OSError - when an error is retu...
oscrypto/_osx/util.py
def rand_bytes(length): """ Returns a number of random bytes suitable for cryptographic purposes :param length: The desired number of bytes :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type ...
def rand_bytes(length): """ Returns a number of random bytes suitable for cryptographic purposes :param length: The desired number of bytes :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type ...
[ "Returns", "a", "number", "of", "random", "bytes", "suitable", "for", "cryptographic", "purposes" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/util.py#L167-L202
[ "def", "rand_bytes", "(", "length", ")", ":", "if", "not", "isinstance", "(", "length", ",", "int_types", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n length must be an integer, not %s\n '''", ",", "type_name", "(", "length"...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_number_to_number
Converts a CFNumber object to a python float or integer :param value: The CFNumber object :return: A python number (float or integer)
oscrypto/_osx/_core_foundation_ctypes.py
def cf_number_to_number(value): """ Converts a CFNumber object to a python float or integer :param value: The CFNumber object :return: A python number (float or integer) """ type_ = CoreFoundation.CFNumberGetType(_cast_pointer_p(value)) ...
def cf_number_to_number(value): """ Converts a CFNumber object to a python float or integer :param value: The CFNumber object :return: A python number (float or integer) """ type_ = CoreFoundation.CFNumberGetType(_cast_pointer_p(value)) ...
[ "Converts", "a", "CFNumber", "object", "to", "a", "python", "float", "or", "integer" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_ctypes.py#L253-L285
[ "def", "cf_number_to_number", "(", "value", ")", ":", "type_", "=", "CoreFoundation", ".", "CFNumberGetType", "(", "_cast_pointer_p", "(", "value", ")", ")", "c_type", "=", "{", "1", ":", "c_byte", ",", "# kCFNumberSInt8Type", "2", ":", "ctypes", ".", "c_sho...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_dictionary_to_dict
Converts a CFDictionary object into a python dictionary :param dictionary: The CFDictionary to convert :return: A python dict
oscrypto/_osx/_core_foundation_ctypes.py
def cf_dictionary_to_dict(dictionary): """ Converts a CFDictionary object into a python dictionary :param dictionary: The CFDictionary to convert :return: A python dict """ dict_length = CoreFoundation.CFDictionaryGetCount(dictionary) k...
def cf_dictionary_to_dict(dictionary): """ Converts a CFDictionary object into a python dictionary :param dictionary: The CFDictionary to convert :return: A python dict """ dict_length = CoreFoundation.CFDictionaryGetCount(dictionary) k...
[ "Converts", "a", "CFDictionary", "object", "into", "a", "python", "dictionary" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_ctypes.py#L288-L313
[ "def", "cf_dictionary_to_dict", "(", "dictionary", ")", ":", "dict_length", "=", "CoreFoundation", ".", "CFDictionaryGetCount", "(", "dictionary", ")", "keys", "=", "(", "CFTypeRef", "*", "dict_length", ")", "(", ")", "values", "=", "(", "CFTypeRef", "*", "dic...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.native
Converts a CF* object into its python equivalent :param value: The CF* object to convert :return: The native python object
oscrypto/_osx/_core_foundation_ctypes.py
def native(cls, value): """ Converts a CF* object into its python equivalent :param value: The CF* object to convert :return: The native python object """ type_id = CoreFoundation.CFGetTypeID(value) if type_id in cls._native_map: ...
def native(cls, value): """ Converts a CF* object into its python equivalent :param value: The CF* object to convert :return: The native python object """ type_id = CoreFoundation.CFGetTypeID(value) if type_id in cls._native_map: ...
[ "Converts", "a", "CF", "*", "object", "into", "its", "python", "equivalent" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_ctypes.py#L316-L331
[ "def", "native", "(", "cls", ",", "value", ")", ":", "type_id", "=", "CoreFoundation", ".", "CFGetTypeID", "(", "value", ")", "if", "type_id", "in", "cls", ".", "_native_map", ":", "return", "cls", ".", "_native_map", "[", "type_id", "]", "(", "value", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_string_to_unicode
Creates a python unicode string from a CFString object :param value: The CFString to convert :return: A python unicode string
oscrypto/_osx/_core_foundation_ctypes.py
def cf_string_to_unicode(value): """ Creates a python unicode string from a CFString object :param value: The CFString to convert :return: A python unicode string """ string = CoreFoundation.CFStringGetCStringPtr( _cast_pointer_p(val...
def cf_string_to_unicode(value): """ Creates a python unicode string from a CFString object :param value: The CFString to convert :return: A python unicode string """ string = CoreFoundation.CFStringGetCStringPtr( _cast_pointer_p(val...
[ "Creates", "a", "python", "unicode", "string", "from", "a", "CFString", "object" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_ctypes.py#L334-L362
[ "def", "cf_string_to_unicode", "(", "value", ")", ":", "string", "=", "CoreFoundation", ".", "CFStringGetCStringPtr", "(", "_cast_pointer_p", "(", "value", ")", ",", "kCFStringEncodingUTF8", ")", "if", "string", "is", "None", ":", "buffer", "=", "buffer_from_bytes...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_data_to_bytes
Extracts a bytestring from a CFData object :param value: A CFData object :return: A byte string
oscrypto/_osx/_core_foundation_ctypes.py
def cf_data_to_bytes(value): """ Extracts a bytestring from a CFData object :param value: A CFData object :return: A byte string """ start = CoreFoundation.CFDataGetBytePtr(value) num_bytes = CoreFoundation.CFDataGetLength(value) ...
def cf_data_to_bytes(value): """ Extracts a bytestring from a CFData object :param value: A CFData object :return: A byte string """ start = CoreFoundation.CFDataGetBytePtr(value) num_bytes = CoreFoundation.CFDataGetLength(value) ...
[ "Extracts", "a", "bytestring", "from", "a", "CFData", "object" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_ctypes.py#L383-L396
[ "def", "cf_data_to_bytes", "(", "value", ")", ":", "start", "=", "CoreFoundation", ".", "CFDataGetBytePtr", "(", "value", ")", "num_bytes", "=", "CoreFoundation", ".", "CFDataGetLength", "(", "value", ")", "return", "string_at", "(", "start", ",", "num_bytes", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_dictionary_from_pairs
Creates a CFDictionaryRef object from a list of 2-element tuples representing the key and value. Each key should be a CFStringRef and each value some sort of CF* type. :param pairs: A list of 2-element tuples :return: A CFDictionaryRef
oscrypto/_osx/_core_foundation_ctypes.py
def cf_dictionary_from_pairs(pairs): """ Creates a CFDictionaryRef object from a list of 2-element tuples representing the key and value. Each key should be a CFStringRef and each value some sort of CF* type. :param pairs: A list of 2-element tuples :return:...
def cf_dictionary_from_pairs(pairs): """ Creates a CFDictionaryRef object from a list of 2-element tuples representing the key and value. Each key should be a CFStringRef and each value some sort of CF* type. :param pairs: A list of 2-element tuples :return:...
[ "Creates", "a", "CFDictionaryRef", "object", "from", "a", "list", "of", "2", "-", "element", "tuples", "representing", "the", "key", "and", "value", ".", "Each", "key", "should", "be", "a", "CFStringRef", "and", "each", "value", "some", "sort", "of", "CF",...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_ctypes.py#L417-L446
[ "def", "cf_dictionary_from_pairs", "(", "pairs", ")", ":", "length", "=", "len", "(", "pairs", ")", "keys", "=", "[", "]", "values", "=", "[", "]", "for", "pair", "in", "pairs", ":", "key", ",", "value", "=", "pair", "keys", ".", "append", "(", "ke...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_array_from_list
Creates a CFArrayRef object from a list of CF* type objects. :param values: A list of CF* type object :return: A CFArrayRef
oscrypto/_osx/_core_foundation_ctypes.py
def cf_array_from_list(values): """ Creates a CFArrayRef object from a list of CF* type objects. :param values: A list of CF* type object :return: A CFArrayRef """ length = len(values) values = (CFTypeRef * length)(*values) retur...
def cf_array_from_list(values): """ Creates a CFArrayRef object from a list of CF* type objects. :param values: A list of CF* type object :return: A CFArrayRef """ length = len(values) values = (CFTypeRef * length)(*values) retur...
[ "Creates", "a", "CFArrayRef", "object", "from", "a", "list", "of", "CF", "*", "type", "objects", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_ctypes.py#L449-L467
[ "def", "cf_array_from_list", "(", "values", ")", ":", "length", "=", "len", "(", "values", ")", "values", "=", "(", "CFTypeRef", "*", "length", ")", "(", "*", "values", ")", "return", "CoreFoundation", ".", "CFArrayCreate", "(", "CoreFoundation", ".", "kCF...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_number_from_integer
Creates a CFNumber object from an integer :param integer: The integer to create the CFNumber for :return: A CFNumber
oscrypto/_osx/_core_foundation_ctypes.py
def cf_number_from_integer(integer): """ Creates a CFNumber object from an integer :param integer: The integer to create the CFNumber for :return: A CFNumber """ integer_as_long = c_long(integer) return CoreFoundation.CFNumberCreate( ...
def cf_number_from_integer(integer): """ Creates a CFNumber object from an integer :param integer: The integer to create the CFNumber for :return: A CFNumber """ integer_as_long = c_long(integer) return CoreFoundation.CFNumberCreate( ...
[ "Creates", "a", "CFNumber", "object", "from", "an", "integer" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_ctypes.py#L470-L486
[ "def", "cf_number_from_integer", "(", "integer", ")", ":", "integer_as_long", "=", "c_long", "(", "integer", ")", "return", "CoreFoundation", ".", "CFNumberCreate", "(", "CoreFoundation", ".", "kCFAllocatorDefault", ",", "kCFNumberCFIndexType", ",", "byref", "(", "i...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_number_to_number
Converts a CFNumber object to a python float or integer :param value: The CFNumber object :return: A python number (float or integer)
oscrypto/_osx/_core_foundation_cffi.py
def cf_number_to_number(value): """ Converts a CFNumber object to a python float or integer :param value: The CFNumber object :return: A python number (float or integer) """ type_ = CoreFoundation.CFNumberGetType(value) type_name_ = { ...
def cf_number_to_number(value): """ Converts a CFNumber object to a python float or integer :param value: The CFNumber object :return: A python number (float or integer) """ type_ = CoreFoundation.CFNumberGetType(value) type_name_ = { ...
[ "Converts", "a", "CFNumber", "object", "to", "a", "python", "float", "or", "integer" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_cffi.py#L153-L185
[ "def", "cf_number_to_number", "(", "value", ")", ":", "type_", "=", "CoreFoundation", ".", "CFNumberGetType", "(", "value", ")", "type_name_", "=", "{", "1", ":", "'int8_t'", ",", "# kCFNumberSInt8Type", "2", ":", "'in16_t'", ",", "# kCFNumberSInt16Type", "3", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_string_to_unicode
Creates a python unicode string from a CFString object :param value: The CFString to convert :return: A python unicode string
oscrypto/_osx/_core_foundation_cffi.py
def cf_string_to_unicode(value): """ Creates a python unicode string from a CFString object :param value: The CFString to convert :return: A python unicode string """ string_ptr = CoreFoundation.CFStringGetCStringPtr( value, ...
def cf_string_to_unicode(value): """ Creates a python unicode string from a CFString object :param value: The CFString to convert :return: A python unicode string """ string_ptr = CoreFoundation.CFStringGetCStringPtr( value, ...
[ "Creates", "a", "python", "unicode", "string", "from", "a", "CFString", "object" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_cffi.py#L234-L263
[ "def", "cf_string_to_unicode", "(", "value", ")", ":", "string_ptr", "=", "CoreFoundation", ".", "CFStringGetCStringPtr", "(", "value", ",", "kCFStringEncodingUTF8", ")", "string", "=", "None", "if", "is_null", "(", "string_ptr", ")", "else", "ffi", ".", "string...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_data_to_bytes
Extracts a bytestring from a CFData object :param value: A CFData object :return: A byte string
oscrypto/_osx/_core_foundation_cffi.py
def cf_data_to_bytes(value): """ Extracts a bytestring from a CFData object :param value: A CFData object :return: A byte string """ start = CoreFoundation.CFDataGetBytePtr(value) num_bytes = CoreFoundation.CFDataGetLength(value) ...
def cf_data_to_bytes(value): """ Extracts a bytestring from a CFData object :param value: A CFData object :return: A byte string """ start = CoreFoundation.CFDataGetBytePtr(value) num_bytes = CoreFoundation.CFDataGetLength(value) ...
[ "Extracts", "a", "bytestring", "from", "a", "CFData", "object" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_cffi.py#L284-L297
[ "def", "cf_data_to_bytes", "(", "value", ")", ":", "start", "=", "CoreFoundation", ".", "CFDataGetBytePtr", "(", "value", ")", "num_bytes", "=", "CoreFoundation", ".", "CFDataGetLength", "(", "value", ")", "return", "ffi", ".", "buffer", "(", "start", ",", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_dictionary_from_pairs
Creates a CFDictionaryRef object from a list of 2-element tuples representing the key and value. Each key should be a CFStringRef and each value some sort of CF* type. :param pairs: A list of 2-element tuples :return: A CFDictionaryRef
oscrypto/_osx/_core_foundation_cffi.py
def cf_dictionary_from_pairs(pairs): """ Creates a CFDictionaryRef object from a list of 2-element tuples representing the key and value. Each key should be a CFStringRef and each value some sort of CF* type. :param pairs: A list of 2-element tuples :return:...
def cf_dictionary_from_pairs(pairs): """ Creates a CFDictionaryRef object from a list of 2-element tuples representing the key and value. Each key should be a CFStringRef and each value some sort of CF* type. :param pairs: A list of 2-element tuples :return:...
[ "Creates", "a", "CFDictionaryRef", "object", "from", "a", "list", "of", "2", "-", "element", "tuples", "representing", "the", "key", "and", "value", ".", "Each", "key", "should", "be", "a", "CFStringRef", "and", "each", "value", "some", "sort", "of", "CF",...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_cffi.py#L318-L345
[ "def", "cf_dictionary_from_pairs", "(", "pairs", ")", ":", "length", "=", "len", "(", "pairs", ")", "keys", "=", "[", "]", "values", "=", "[", "]", "for", "pair", "in", "pairs", ":", "key", ",", "value", "=", "pair", "keys", ".", "append", "(", "ke...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_array_from_list
Creates a CFArrayRef object from a list of CF* type objects. :param values: A list of CF* type object :return: A CFArrayRef
oscrypto/_osx/_core_foundation_cffi.py
def cf_array_from_list(values): """ Creates a CFArrayRef object from a list of CF* type objects. :param values: A list of CF* type object :return: A CFArrayRef """ length = len(values) return CoreFoundation.CFArrayCreate( Cor...
def cf_array_from_list(values): """ Creates a CFArrayRef object from a list of CF* type objects. :param values: A list of CF* type object :return: A CFArrayRef """ length = len(values) return CoreFoundation.CFArrayCreate( Cor...
[ "Creates", "a", "CFArrayRef", "object", "from", "a", "list", "of", "CF", "*", "type", "objects", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_cffi.py#L348-L365
[ "def", "cf_array_from_list", "(", "values", ")", ":", "length", "=", "len", "(", "values", ")", "return", "CoreFoundation", ".", "CFArrayCreate", "(", "CoreFoundation", ".", "kCFAllocatorDefault", ",", "values", ",", "length", ",", "ffi", ".", "addressof", "("...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
CFHelpers.cf_number_from_integer
Creates a CFNumber object from an integer :param integer: The integer to create the CFNumber for :return: A CFNumber
oscrypto/_osx/_core_foundation_cffi.py
def cf_number_from_integer(integer): """ Creates a CFNumber object from an integer :param integer: The integer to create the CFNumber for :return: A CFNumber """ integer_as_long = ffi.new('long *', integer) return CoreFoundation.CFNumber...
def cf_number_from_integer(integer): """ Creates a CFNumber object from an integer :param integer: The integer to create the CFNumber for :return: A CFNumber """ integer_as_long = ffi.new('long *', integer) return CoreFoundation.CFNumber...
[ "Creates", "a", "CFNumber", "object", "from", "an", "integer" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_core_foundation_cffi.py#L368-L384
[ "def", "cf_number_from_integer", "(", "integer", ")", ":", "integer_as_long", "=", "ffi", ".", "new", "(", "'long *'", ",", "integer", ")", "return", "CoreFoundation", ".", "CFNumberCreate", "(", "CoreFoundation", ".", "kCFAllocatorDefault", ",", "kCFNumberCFIndexTy...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
dump_dh_parameters
Serializes an asn1crypto.algos.DHParameters object into a byte string :param dh_parameters: An asn1crypto.algos.DHParameters object :param encoding: A unicode string of "pem" or "der" :return: A byte string of the encoded DH parameters
oscrypto/asymmetric.py
def dump_dh_parameters(dh_parameters, encoding='pem'): """ Serializes an asn1crypto.algos.DHParameters object into a byte string :param dh_parameters: An asn1crypto.algos.DHParameters object :param encoding: A unicode string of "pem" or "der" :return: A byte string of the ...
def dump_dh_parameters(dh_parameters, encoding='pem'): """ Serializes an asn1crypto.algos.DHParameters object into a byte string :param dh_parameters: An asn1crypto.algos.DHParameters object :param encoding: A unicode string of "pem" or "der" :return: A byte string of the ...
[ "Serializes", "an", "asn1crypto", ".", "algos", ".", "DHParameters", "object", "into", "a", "byte", "string" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/asymmetric.py#L145-L179
[ "def", "dump_dh_parameters", "(", "dh_parameters", ",", "encoding", "=", "'pem'", ")", ":", "if", "encoding", "not", "in", "set", "(", "[", "'pem'", ",", "'der'", "]", ")", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n encoding must...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
dump_public_key
Serializes a public key object into a byte string :param public_key: An oscrypto.asymmetric.PublicKey or asn1crypto.keys.PublicKeyInfo object :param encoding: A unicode string of "pem" or "der" :return: A byte string of the encoded public key
oscrypto/asymmetric.py
def dump_public_key(public_key, encoding='pem'): """ Serializes a public key object into a byte string :param public_key: An oscrypto.asymmetric.PublicKey or asn1crypto.keys.PublicKeyInfo object :param encoding: A unicode string of "pem" or "der" :return: A byte string of ...
def dump_public_key(public_key, encoding='pem'): """ Serializes a public key object into a byte string :param public_key: An oscrypto.asymmetric.PublicKey or asn1crypto.keys.PublicKeyInfo object :param encoding: A unicode string of "pem" or "der" :return: A byte string of ...
[ "Serializes", "a", "public", "key", "object", "into", "a", "byte", "string" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/asymmetric.py#L182-L220
[ "def", "dump_public_key", "(", "public_key", ",", "encoding", "=", "'pem'", ")", ":", "if", "encoding", "not", "in", "set", "(", "[", "'pem'", ",", "'der'", "]", ")", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n encoding must be on...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
dump_certificate
Serializes a certificate object into a byte string :param certificate: An oscrypto.asymmetric.Certificate or asn1crypto.x509.Certificate object :param encoding: A unicode string of "pem" or "der" :return: A byte string of the encoded certificate
oscrypto/asymmetric.py
def dump_certificate(certificate, encoding='pem'): """ Serializes a certificate object into a byte string :param certificate: An oscrypto.asymmetric.Certificate or asn1crypto.x509.Certificate object :param encoding: A unicode string of "pem" or "der" :return: A byte string...
def dump_certificate(certificate, encoding='pem'): """ Serializes a certificate object into a byte string :param certificate: An oscrypto.asymmetric.Certificate or asn1crypto.x509.Certificate object :param encoding: A unicode string of "pem" or "der" :return: A byte string...
[ "Serializes", "a", "certificate", "object", "into", "a", "byte", "string" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/asymmetric.py#L223-L261
[ "def", "dump_certificate", "(", "certificate", ",", "encoding", "=", "'pem'", ")", ":", "if", "encoding", "not", "in", "set", "(", "[", "'pem'", ",", "'der'", "]", ")", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n encoding must be ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
dump_private_key
Serializes a private key object into a byte string of the PKCS#8 format :param private_key: An oscrypto.asymmetric.PrivateKey or asn1crypto.keys.PrivateKeyInfo object :param passphrase: A unicode string of the passphrase to encrypt the private key with. A passphrase of None wil...
oscrypto/asymmetric.py
def dump_private_key(private_key, passphrase, encoding='pem', target_ms=200): """ Serializes a private key object into a byte string of the PKCS#8 format :param private_key: An oscrypto.asymmetric.PrivateKey or asn1crypto.keys.PrivateKeyInfo object :param passphrase: A unicode ...
def dump_private_key(private_key, passphrase, encoding='pem', target_ms=200): """ Serializes a private key object into a byte string of the PKCS#8 format :param private_key: An oscrypto.asymmetric.PrivateKey or asn1crypto.keys.PrivateKeyInfo object :param passphrase: A unicode ...
[ "Serializes", "a", "private", "key", "object", "into", "a", "byte", "string", "of", "the", "PKCS#8", "format" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/asymmetric.py#L264-L379
[ "def", "dump_private_key", "(", "private_key", ",", "passphrase", ",", "encoding", "=", "'pem'", ",", "target_ms", "=", "200", ")", ":", "if", "encoding", "not", "in", "set", "(", "[", "'pem'", ",", "'der'", "]", ")", ":", "raise", "ValueError", "(", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
dump_openssl_private_key
Serializes a private key object into a byte string of the PEM formats used by OpenSSL. The format chosen will depend on the type of private key - RSA, DSA or EC. Do not use this method unless you really must interact with a system that does not support PKCS#8 private keys. The encryption provided by PK...
oscrypto/asymmetric.py
def dump_openssl_private_key(private_key, passphrase): """ Serializes a private key object into a byte string of the PEM formats used by OpenSSL. The format chosen will depend on the type of private key - RSA, DSA or EC. Do not use this method unless you really must interact with a system that ...
def dump_openssl_private_key(private_key, passphrase): """ Serializes a private key object into a byte string of the PEM formats used by OpenSSL. The format chosen will depend on the type of private key - RSA, DSA or EC. Do not use this method unless you really must interact with a system that ...
[ "Serializes", "a", "private", "key", "object", "into", "a", "byte", "string", "of", "the", "PEM", "formats", "used", "by", "OpenSSL", ".", "The", "format", "chosen", "will", "depend", "on", "the", "type", "of", "private", "key", "-", "RSA", "DSA", "or", ...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/asymmetric.py#L382-L467
[ "def", "dump_openssl_private_key", "(", "private_key", ",", "passphrase", ")", ":", "if", "passphrase", "is", "not", "None", ":", "if", "not", "isinstance", "(", "passphrase", ",", "str_cls", ")", ":", "raise", "TypeError", "(", "pretty_message", "(", "'''\n ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
handle_sec_error
Checks a Security OSStatus error code and throws an exception if there is an error to report :param error: An OSStatus :param exception_class: The exception class to use for the exception if an error occurred :raises: OSError - when the OSStatus contains an error
oscrypto/_osx/_security.py
def handle_sec_error(error, exception_class=None): """ Checks a Security OSStatus error code and throws an exception if there is an error to report :param error: An OSStatus :param exception_class: The exception class to use for the exception if an error occurred :raises: ...
def handle_sec_error(error, exception_class=None): """ Checks a Security OSStatus error code and throws an exception if there is an error to report :param error: An OSStatus :param exception_class: The exception class to use for the exception if an error occurred :raises: ...
[ "Checks", "a", "Security", "OSStatus", "error", "code", "and", "throws", "an", "exception", "if", "there", "is", "an", "error", "to", "report" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_osx/_security.py#L23-L56
[ "def", "handle_sec_error", "(", "error", ",", "exception_class", "=", "None", ")", ":", "if", "error", "==", "0", ":", "return", "if", "error", "in", "set", "(", "[", "SecurityConst", ".", "errSSLClosedNoNotify", ",", "SecurityConst", ".", "errSSLClosedAbort",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_get_func_info
Extracts the function signature and description of a Python function :param docstring: A unicode string of the docstring for the function :param def_lineno: An integer line number that function was defined on :param code_lines: A list of unicode string lines from the source file t...
dev/api_docs.py
def _get_func_info(docstring, def_lineno, code_lines, prefix): """ Extracts the function signature and description of a Python function :param docstring: A unicode string of the docstring for the function :param def_lineno: An integer line number that function was defined on :para...
def _get_func_info(docstring, def_lineno, code_lines, prefix): """ Extracts the function signature and description of a Python function :param docstring: A unicode string of the docstring for the function :param def_lineno: An integer line number that function was defined on :para...
[ "Extracts", "the", "function", "signature", "and", "description", "of", "a", "Python", "function" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/dev/api_docs.py#L20-L88
[ "def", "_get_func_info", "(", "docstring", ",", "def_lineno", ",", "code_lines", ",", "prefix", ")", ":", "def_index", "=", "def_lineno", "-", "1", "definition", "=", "code_lines", "[", "def_index", "]", "definition", "=", "definition", ".", "rstrip", "(", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_find_sections
Walks through a CommonMark AST to find section headers that delineate content that should be updated by this script :param md_ast: The AST of the markdown document :param sections: A dict to store the start and end lines of a section. The key will be a two-element tuple of the sect...
dev/api_docs.py
def _find_sections(md_ast, sections, last, last_class, total_lines=None): """ Walks through a CommonMark AST to find section headers that delineate content that should be updated by this script :param md_ast: The AST of the markdown document :param sections: A dict to store the sta...
def _find_sections(md_ast, sections, last, last_class, total_lines=None): """ Walks through a CommonMark AST to find section headers that delineate content that should be updated by this script :param md_ast: The AST of the markdown document :param sections: A dict to store the sta...
[ "Walks", "through", "a", "CommonMark", "AST", "to", "find", "section", "headers", "that", "delineate", "content", "that", "should", "be", "updated", "by", "this", "script" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/dev/api_docs.py#L91-L178
[ "def", "_find_sections", "(", "md_ast", ",", "sections", ",", "last", ",", "last_class", ",", "total_lines", "=", "None", ")", ":", "def", "child_walker", "(", "node", ")", ":", "for", "child", ",", "entering", "in", "node", ".", "walker", "(", ")", ":...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
walk_ast
A callback used to walk the Python AST looking for classes, functions, methods and attributes. Generates chunks of markdown markup to replace the existing content. :param node: An _ast module node object :param code_lines: A list of unicode strings - the source lines of the Python file...
dev/api_docs.py
def walk_ast(node, code_lines, sections, md_chunks): """ A callback used to walk the Python AST looking for classes, functions, methods and attributes. Generates chunks of markdown markup to replace the existing content. :param node: An _ast module node object :param code_lines: ...
def walk_ast(node, code_lines, sections, md_chunks): """ A callback used to walk the Python AST looking for classes, functions, methods and attributes. Generates chunks of markdown markup to replace the existing content. :param node: An _ast module node object :param code_lines: ...
[ "A", "callback", "used", "to", "walk", "the", "Python", "AST", "looking", "for", "classes", "functions", "methods", "and", "attributes", ".", "Generates", "chunks", "of", "markdown", "markup", "to", "replace", "the", "existing", "content", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/dev/api_docs.py#L184-L335
[ "def", "walk_ast", "(", "node", ",", "code_lines", ",", "sections", ",", "md_chunks", ")", ":", "if", "isinstance", "(", "node", ",", "_ast", ".", "FunctionDef", ")", ":", "key", "=", "(", "'function'", ",", "node", ".", "name", ")", "if", "key", "no...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
run
Looks through the docs/ dir and parses each markdown document, looking for sections to update from Python docstrings. Looks for section headers in the format: - ### `ClassName()` class - ##### `.method_name()` method - ##### `.attribute_name` attribute - ### `function_name()` function ...
dev/api_docs.py
def run(): """ Looks through the docs/ dir and parses each markdown document, looking for sections to update from Python docstrings. Looks for section headers in the format: - ### `ClassName()` class - ##### `.method_name()` method - ##### `.attribute_name` attribute - ### `function...
def run(): """ Looks through the docs/ dir and parses each markdown document, looking for sections to update from Python docstrings. Looks for section headers in the format: - ### `ClassName()` class - ##### `.method_name()` method - ##### `.attribute_name` attribute - ### `function...
[ "Looks", "through", "the", "docs", "/", "dir", "and", "parses", "each", "markdown", "document", "looking", "for", "sections", "to", "update", "from", "Python", "docstrings", ".", "Looks", "for", "section", "headers", "in", "the", "format", ":" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/dev/api_docs.py#L338-L432
[ "def", "run", "(", ")", ":", "print", "(", "'Updating API docs...'", ")", "md_files", "=", "[", "]", "for", "root", ",", "_", ",", "filenames", "in", "os", ".", "walk", "(", "os", ".", "path", ".", "join", "(", "package_root", ",", "'docs'", ")", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
ec_generate_pair
Generates a EC public/private key pair :param curve: A unicode string. Valid values include "secp256r1", "secp384r1" and "secp521r1". :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the parameters are of the wrong type :ret...
oscrypto/_ecdsa.py
def ec_generate_pair(curve): """ Generates a EC public/private key pair :param curve: A unicode string. Valid values include "secp256r1", "secp384r1" and "secp521r1". :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the p...
def ec_generate_pair(curve): """ Generates a EC public/private key pair :param curve: A unicode string. Valid values include "secp256r1", "secp384r1" and "secp521r1". :raises: ValueError - when any of the parameters contain an invalid value TypeError - when any of the p...
[ "Generates", "a", "EC", "public", "/", "private", "key", "pair" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_ecdsa.py#L65-L121
[ "def", "ec_generate_pair", "(", "curve", ")", ":", "if", "curve", "not", "in", "set", "(", "[", "'secp256r1'", ",", "'secp384r1'", ",", "'secp521r1'", "]", ")", ":", "raise", "ValueError", "(", "pretty_message", "(", "'''\n curve must be one of \"secp25...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
ecdsa_sign
Generates an ECDSA signature in pure Python (thus slow) :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode string of "sha1", "sha256", "sha384" or "sha512" :raises: ...
oscrypto/_ecdsa.py
def ecdsa_sign(private_key, data, hash_algorithm): """ Generates an ECDSA signature in pure Python (thus slow) :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode str...
def ecdsa_sign(private_key, data, hash_algorithm): """ Generates an ECDSA signature in pure Python (thus slow) :param private_key: The PrivateKey to generate the signature with :param data: A byte string of the data the signature is for :param hash_algorithm: A unicode str...
[ "Generates", "an", "ECDSA", "signature", "in", "pure", "Python", "(", "thus", "slow", ")" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_ecdsa.py#L124-L250
[ "def", "ecdsa_sign", "(", "private_key", ",", "data", ",", "hash_algorithm", ")", ":", "if", "not", "hasattr", "(", "private_key", ",", "'asn1'", ")", "or", "not", "isinstance", "(", "private_key", ".", "asn1", ",", "keys", ".", "PrivateKeyInfo", ")", ":",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
ecdsa_verify
Verifies an ECDSA signature in pure Python (thus slow) :param certificate_or_public_key: A Certificate or PublicKey instance to verify the signature with :param signature: A byte string of the signature to verify :param data: A byte string of the data the signature is for :pa...
oscrypto/_ecdsa.py
def ecdsa_verify(certificate_or_public_key, signature, data, hash_algorithm): """ Verifies an ECDSA signature in pure Python (thus slow) :param certificate_or_public_key: A Certificate or PublicKey instance to verify the signature with :param signature: A byte string of the signature t...
def ecdsa_verify(certificate_or_public_key, signature, data, hash_algorithm): """ Verifies an ECDSA signature in pure Python (thus slow) :param certificate_or_public_key: A Certificate or PublicKey instance to verify the signature with :param signature: A byte string of the signature t...
[ "Verifies", "an", "ECDSA", "signature", "in", "pure", "Python", "(", "thus", "slow", ")" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_ecdsa.py#L253-L367
[ "def", "ecdsa_verify", "(", "certificate_or_public_key", ",", "signature", ",", "data", ",", "hash_algorithm", ")", ":", "has_asn1", "=", "hasattr", "(", "certificate_or_public_key", ",", "'asn1'", ")", "if", "not", "has_asn1", "or", "not", "isinstance", "(", "c...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
system_path
Tries to find a CA certs bundle in common locations :raises: OSError - when no valid CA certs bundle was found on the filesystem :return: The full filesystem path to a CA certs bundle file
oscrypto/_linux_bsd/trust_list.py
def system_path(): """ Tries to find a CA certs bundle in common locations :raises: OSError - when no valid CA certs bundle was found on the filesystem :return: The full filesystem path to a CA certs bundle file """ ca_path = None # Common CA cert paths paths = [ ...
def system_path(): """ Tries to find a CA certs bundle in common locations :raises: OSError - when no valid CA certs bundle was found on the filesystem :return: The full filesystem path to a CA certs bundle file """ ca_path = None # Common CA cert paths paths = [ ...
[ "Tries", "to", "find", "a", "CA", "certs", "bundle", "in", "common", "locations" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_linux_bsd/trust_list.py#L18-L59
[ "def", "system_path", "(", ")", ":", "ca_path", "=", "None", "# Common CA cert paths", "paths", "=", "[", "'/usr/lib/ssl/certs/ca-certificates.crt'", ",", "'/etc/ssl/certs/ca-certificates.crt'", ",", "'/etc/ssl/certs/ca-bundle.crt'", ",", "'/etc/pki/tls/certs/ca-bundle.crt'", "...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
extract_from_system
Extracts trusted CA certs from the system CA cert bundle :param cert_callback: A callback that is called once for each certificate in the trust store. It should accept two parameters: an asn1crypto.x509.Certificate object, and a reason. The reason will be None if the certificate is being ...
oscrypto/_linux_bsd/trust_list.py
def extract_from_system(cert_callback=None, callback_only_on_failure=False): """ Extracts trusted CA certs from the system CA cert bundle :param cert_callback: A callback that is called once for each certificate in the trust store. It should accept two parameters: an asn1crypto.x509.Certifi...
def extract_from_system(cert_callback=None, callback_only_on_failure=False): """ Extracts trusted CA certs from the system CA cert bundle :param cert_callback: A callback that is called once for each certificate in the trust store. It should accept two parameters: an asn1crypto.x509.Certifi...
[ "Extracts", "trusted", "CA", "certs", "from", "the", "system", "CA", "cert", "bundle" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_linux_bsd/trust_list.py#L62-L122
[ "def", "extract_from_system", "(", "cert_callback", "=", "None", ",", "callback_only_on_failure", "=", "False", ")", ":", "all_purposes", "=", "'2.5.29.37.0'", "ca_path", "=", "system_path", "(", ")", "output", "=", "[", "]", "with", "open", "(", "ca_path", ",...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
extract_from_system
Extracts trusted CA certificates from the Windows certificate store :param cert_callback: A callback that is called once for each certificate in the trust store. It should accept two parameters: an asn1crypto.x509.Certificate object, and a reason. The reason will be None if the certificate ...
oscrypto/_win/trust_list.py
def extract_from_system(cert_callback=None, callback_only_on_failure=False): """ Extracts trusted CA certificates from the Windows certificate store :param cert_callback: A callback that is called once for each certificate in the trust store. It should accept two parameters: an asn1crypto.x...
def extract_from_system(cert_callback=None, callback_only_on_failure=False): """ Extracts trusted CA certificates from the Windows certificate store :param cert_callback: A callback that is called once for each certificate in the trust store. It should accept two parameters: an asn1crypto.x...
[ "Extracts", "trusted", "CA", "certificates", "from", "the", "Windows", "certificate", "store" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/trust_list.py#L36-L202
[ "def", "extract_from_system", "(", "cert_callback", "=", "None", ",", "callback_only_on_failure", "=", "False", ")", ":", "certificates", "=", "{", "}", "processed", "=", "{", "}", "now", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "for", "s...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_convert_filetime_to_timestamp
Windows returns times as 64-bit unsigned longs that are the number of hundreds of nanoseconds since Jan 1 1601. This converts it to a datetime object. :param filetime: A FILETIME struct object :return: An integer unix timestamp
oscrypto/_win/trust_list.py
def _convert_filetime_to_timestamp(filetime): """ Windows returns times as 64-bit unsigned longs that are the number of hundreds of nanoseconds since Jan 1 1601. This converts it to a datetime object. :param filetime: A FILETIME struct object :return: An integer unix timestamp ...
def _convert_filetime_to_timestamp(filetime): """ Windows returns times as 64-bit unsigned longs that are the number of hundreds of nanoseconds since Jan 1 1601. This converts it to a datetime object. :param filetime: A FILETIME struct object :return: An integer unix timestamp ...
[ "Windows", "returns", "times", "as", "64", "-", "bit", "unsigned", "longs", "that", "are", "the", "number", "of", "hundreds", "of", "nanoseconds", "since", "Jan", "1", "1601", ".", "This", "converts", "it", "to", "a", "datetime", "object", "." ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_win/trust_list.py#L205-L227
[ "def", "_convert_filetime_to_timestamp", "(", "filetime", ")", ":", "hundreds_nano_seconds", "=", "struct", ".", "unpack", "(", "b'>Q'", ",", "struct", ".", "pack", "(", "b'>LL'", ",", "filetime", ".", "dwHighDateTime", ",", "filetime", ".", "dwLowDateTime", ")"...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
extract_chain
Extracts the X.509 certificates from the server handshake bytes for use when debugging :param server_handshake_bytes: A byte string of the handshake data received from the server :return: A list of asn1crypto.x509.Certificate objects
oscrypto/_tls.py
def extract_chain(server_handshake_bytes): """ Extracts the X.509 certificates from the server handshake bytes for use when debugging :param server_handshake_bytes: A byte string of the handshake data received from the server :return: A list of asn1crypto.x509.Certificate objects ...
def extract_chain(server_handshake_bytes): """ Extracts the X.509 certificates from the server handshake bytes for use when debugging :param server_handshake_bytes: A byte string of the handshake data received from the server :return: A list of asn1crypto.x509.Certificate objects ...
[ "Extracts", "the", "X", ".", "509", "certificates", "from", "the", "server", "handshake", "bytes", "for", "use", "when", "debugging" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L37-L74
[ "def", "extract_chain", "(", "server_handshake_bytes", ")", ":", "output", "=", "[", "]", "chain_bytes", "=", "None", "for", "record_type", ",", "_", ",", "record_data", "in", "parse_tls_records", "(", "server_handshake_bytes", ")", ":", "if", "record_type", "!=...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
detect_client_auth_request
Determines if a CertificateRequest message is sent from the server asking the client for a certificate :param server_handshake_bytes: A byte string of the handshake data received from the server :return: A boolean - if a client certificate request was found
oscrypto/_tls.py
def detect_client_auth_request(server_handshake_bytes): """ Determines if a CertificateRequest message is sent from the server asking the client for a certificate :param server_handshake_bytes: A byte string of the handshake data received from the server :return: A boolean - if a c...
def detect_client_auth_request(server_handshake_bytes): """ Determines if a CertificateRequest message is sent from the server asking the client for a certificate :param server_handshake_bytes: A byte string of the handshake data received from the server :return: A boolean - if a c...
[ "Determines", "if", "a", "CertificateRequest", "message", "is", "sent", "from", "the", "server", "asking", "the", "client", "for", "a", "certificate" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L77-L95
[ "def", "detect_client_auth_request", "(", "server_handshake_bytes", ")", ":", "for", "record_type", ",", "_", ",", "record_data", "in", "parse_tls_records", "(", "server_handshake_bytes", ")", ":", "if", "record_type", "!=", "b'\\x16'", ":", "continue", "for", "mess...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
get_dh_params_length
Determines the length of the DH params from the ServerKeyExchange :param server_handshake_bytes: A byte string of the handshake data received from the server :return: None or an integer of the bit size of the DH parameters
oscrypto/_tls.py
def get_dh_params_length(server_handshake_bytes): """ Determines the length of the DH params from the ServerKeyExchange :param server_handshake_bytes: A byte string of the handshake data received from the server :return: None or an integer of the bit size of the DH parameters """ ...
def get_dh_params_length(server_handshake_bytes): """ Determines the length of the DH params from the ServerKeyExchange :param server_handshake_bytes: A byte string of the handshake data received from the server :return: None or an integer of the bit size of the DH parameters """ ...
[ "Determines", "the", "length", "of", "the", "DH", "params", "from", "the", "ServerKeyExchange" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L98-L126
[ "def", "get_dh_params_length", "(", "server_handshake_bytes", ")", ":", "output", "=", "None", "dh_params_bytes", "=", "None", "for", "record_type", ",", "_", ",", "record_data", "in", "parse_tls_records", "(", "server_handshake_bytes", ")", ":", "if", "record_type"...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
parse_alert
Parses the handshake for protocol alerts :param server_handshake_bytes: A byte string of the handshake data received from the server :return: None or an 2-element tuple of integers: 0: 1 (warning) or 2 (fatal) 1: The alert description (see https://tools.ietf.org/html/rfc5246#...
oscrypto/_tls.py
def parse_alert(server_handshake_bytes): """ Parses the handshake for protocol alerts :param server_handshake_bytes: A byte string of the handshake data received from the server :return: None or an 2-element tuple of integers: 0: 1 (warning) or 2 (fatal) 1: The alert ...
def parse_alert(server_handshake_bytes): """ Parses the handshake for protocol alerts :param server_handshake_bytes: A byte string of the handshake data received from the server :return: None or an 2-element tuple of integers: 0: 1 (warning) or 2 (fatal) 1: The alert ...
[ "Parses", "the", "handshake", "for", "protocol", "alerts" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L129-L148
[ "def", "parse_alert", "(", "server_handshake_bytes", ")", ":", "for", "record_type", ",", "_", ",", "record_data", "in", "parse_tls_records", "(", "server_handshake_bytes", ")", ":", "if", "record_type", "!=", "b'\\x15'", ":", "continue", "if", "len", "(", "reco...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
parse_session_info
Parse the TLS handshake from the client to the server to extract information including the cipher suite selected, if compression is enabled, the session id and if a new or reused session ticket exists. :param server_handshake_bytes: A byte string of the handshake data received from the server ...
oscrypto/_tls.py
def parse_session_info(server_handshake_bytes, client_handshake_bytes): """ Parse the TLS handshake from the client to the server to extract information including the cipher suite selected, if compression is enabled, the session id and if a new or reused session ticket exists. :param server_handsha...
def parse_session_info(server_handshake_bytes, client_handshake_bytes): """ Parse the TLS handshake from the client to the server to extract information including the cipher suite selected, if compression is enabled, the session id and if a new or reused session ticket exists. :param server_handsha...
[ "Parse", "the", "TLS", "handshake", "from", "the", "client", "to", "the", "server", "to", "extract", "information", "including", "the", "cipher", "suite", "selected", "if", "compression", "is", "enabled", "the", "session", "id", "and", "if", "a", "new", "or"...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L151-L259
[ "def", "parse_session_info", "(", "server_handshake_bytes", ",", "client_handshake_bytes", ")", ":", "protocol", "=", "None", "cipher_suite", "=", "None", "compression", "=", "False", "session_id", "=", "None", "session_ticket", "=", "None", "server_session_id", "=", ...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
parse_tls_records
Creates a generator returning tuples of information about each record in a byte string of data from a TLS client or server. Stops as soon as it find a ChangeCipherSpec message since all data from then on is encrypted. :param data: A byte string of TLS records :return: A generator that ...
oscrypto/_tls.py
def parse_tls_records(data): """ Creates a generator returning tuples of information about each record in a byte string of data from a TLS client or server. Stops as soon as it find a ChangeCipherSpec message since all data from then on is encrypted. :param data: A byte string of TLS record...
def parse_tls_records(data): """ Creates a generator returning tuples of information about each record in a byte string of data from a TLS client or server. Stops as soon as it find a ChangeCipherSpec message since all data from then on is encrypted. :param data: A byte string of TLS record...
[ "Creates", "a", "generator", "returning", "tuples", "of", "information", "about", "each", "record", "in", "a", "byte", "string", "of", "data", "from", "a", "TLS", "client", "or", "server", ".", "Stops", "as", "soon", "as", "it", "find", "a", "ChangeCipherS...
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L262-L290
[ "def", "parse_tls_records", "(", "data", ")", ":", "pointer", "=", "0", "data_len", "=", "len", "(", "data", ")", "while", "pointer", "<", "data_len", ":", "# Don't try to parse any more once the ChangeCipherSpec is found", "if", "data", "[", "pointer", ":", "poin...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
parse_handshake_messages
Creates a generator returning tuples of information about each message in a byte string of data from a TLS handshake record :param data: A byte string of a TLS handshake record data :return: A generator that yields 2-element tuples: [0] Byte string of message type [1] Byte ...
oscrypto/_tls.py
def parse_handshake_messages(data): """ Creates a generator returning tuples of information about each message in a byte string of data from a TLS handshake record :param data: A byte string of a TLS handshake record data :return: A generator that yields 2-element tuples: [...
def parse_handshake_messages(data): """ Creates a generator returning tuples of information about each message in a byte string of data from a TLS handshake record :param data: A byte string of a TLS handshake record data :return: A generator that yields 2-element tuples: [...
[ "Creates", "a", "generator", "returning", "tuples", "of", "information", "about", "each", "message", "in", "a", "byte", "string", "of", "data", "from", "a", "TLS", "handshake", "record" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L293-L315
[ "def", "parse_handshake_messages", "(", "data", ")", ":", "pointer", "=", "0", "data_len", "=", "len", "(", "data", ")", "while", "pointer", "<", "data_len", ":", "length", "=", "int_from_bytes", "(", "data", "[", "pointer", "+", "1", ":", "pointer", "+"...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c
valid
_parse_hello_extensions
Creates a generator returning tuples of information about each extension from a byte string of extension data contained in a ServerHello ores ClientHello message :param data: A byte string of a extension data from a TLS ServerHello or ClientHello message :return: A generator th...
oscrypto/_tls.py
def _parse_hello_extensions(data): """ Creates a generator returning tuples of information about each extension from a byte string of extension data contained in a ServerHello ores ClientHello message :param data: A byte string of a extension data from a TLS ServerHello or ClientHello ...
def _parse_hello_extensions(data): """ Creates a generator returning tuples of information about each extension from a byte string of extension data contained in a ServerHello ores ClientHello message :param data: A byte string of a extension data from a TLS ServerHello or ClientHello ...
[ "Creates", "a", "generator", "returning", "tuples", "of", "information", "about", "each", "extension", "from", "a", "byte", "string", "of", "extension", "data", "contained", "in", "a", "ServerHello", "ores", "ClientHello", "message" ]
wbond/oscrypto
python
https://github.com/wbond/oscrypto/blob/af778bf1c88bf6c4a7342f5353b130686a5bbe1c/oscrypto/_tls.py#L318-L349
[ "def", "_parse_hello_extensions", "(", "data", ")", ":", "if", "data", "==", "b''", ":", "return", "extentions_length", "=", "int_from_bytes", "(", "data", "[", "0", ":", "2", "]", ")", "extensions_start", "=", "2", "extensions_end", "=", "2", "+", "extent...
af778bf1c88bf6c4a7342f5353b130686a5bbe1c