Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 19 for Ciphertext (0.07 sec)

  1. internal/kms/secret-key.go

    // and MinKMS, and legacy JSON formatted ciphertexts.
    func (s secretKey) Decrypt(_ context.Context, req *DecryptRequest) ([]byte, error) {
    	if req.Name != s.keyID {
    		return nil, ErrKeyNotFound
    	}
    
    	const randSize = 28
    	ciphertext, keyType := parseCiphertext(req.Ciphertext)
    	ciphertext, random := ciphertext[:len(ciphertext)-randSize], ciphertext[len(ciphertext)-randSize:]
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Sun Aug 18 06:43:03 UTC 2024
    - 8.3K bytes
    - Viewed (0)
  2. internal/kms/conn.go

    		Version    uint32 `json:"version,omitempty"`
    		Ciphertext []byte `json:"ciphertext"`
    	}
    	return json.Marshal(JSON{
    		KeyID:      d.KeyID,
    		Version:    uint32(d.Version),
    		Ciphertext: d.Ciphertext,
    	})
    }
    
    // UnmarshalText tries to decode text as JSON representation
    // of a DEK and sets DEK's key ID and ciphertext to the
    // decoded values.
    //
    // It sets DEK's plaintext to nil.
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Sun Aug 18 06:43:03 UTC 2024
    - 5K bytes
    - Viewed (0)
  3. internal/config/crypto.go

    // The context is bound to the returned ciphertext.
    //
    // The same context must be provided when decrypting the
    // ciphertext.
    func EncryptBytes(k *kms.KMS, plaintext []byte, context kms.Context) ([]byte, error) {
    	ciphertext, err := Encrypt(k, bytes.NewReader(plaintext), context)
    	if err != nil {
    		return nil, err
    	}
    	return io.ReadAll(ciphertext)
    }
    
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue May 07 23:55:37 UTC 2024
    - 5K bytes
    - Viewed (0)
  4. internal/kms/dek_test.go

    		}
    		if key.Plaintext != nil {
    			t.Fatalf("Test %d: unmarshaled DEK contains non-nil plaintext", i)
    		}
    		if !bytes.Equal(key.Ciphertext, test.Key.Ciphertext) {
    			t.Fatalf("Test %d: ciphertext mismatch: got %x - want %x", i, key.Ciphertext, test.Key.Ciphertext)
    		}
    	}
    }
    
    func mustDecodeB64(s string) []byte {
    	b, err := base64.StdEncoding.DecodeString(s)
    	if err != nil {
    		panic(err)
    	}
    	return b
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue May 07 23:55:37 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  5. internal/kms/secret-key_test.go

    	if err != nil {
    		t.Fatalf("Failed to generate key: %v", err)
    	}
    	plaintext, err := KMS.Decrypt(context.TODO(), &DecryptRequest{
    		Name:       key.KeyID,
    		Ciphertext: key.Ciphertext,
    	})
    	if err != nil {
    		t.Fatalf("Failed to decrypt key: %v", err)
    	}
    	if !bytes.Equal(key.Plaintext, plaintext) {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue May 07 23:55:37 UTC 2024
    - 2.9K bytes
    - Viewed (0)
  6. src/main/java/jcifs/smb1/util/DES.java

        }
    
    
        /// Encrypt a block of bytes.
        public void encrypt( byte[] clearText, byte[] cipherText )  {
            encrypt( clearText, 0, cipherText, 0 );
        }
    
        /// Decrypt a block of bytes.
        public void decrypt( byte[] cipherText, byte[] clearText ) {
    
            decrypt( cipherText, 0, clearText, 0 );
        }
    
        /**
         * encrypts an array where the length must be a multiple of 8
    Registered: Sun Nov 03 00:10:13 UTC 2024
    - Last Modified: Fri Mar 22 20:39:42 UTC 2019
    - 21.4K bytes
    - Viewed (0)
  7. internal/config/crypto_test.go

    	if err != nil {
    		t.Fatalf("Failed to create KMS: %v", err)
    	}
    
    	for i, test := range encryptDecryptTests {
    		ciphertext, err := Encrypt(KMS, bytes.NewReader(test.Data), test.Context)
    		if err != nil {
    			t.Fatalf("Test %d: failed to encrypt stream: %v", i, err)
    		}
    		data, err := io.ReadAll(ciphertext)
    		if err != nil {
    			t.Fatalf("Test %d: failed to encrypt stream: %v", i, err)
    		}
    
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue May 07 23:55:37 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  8. internal/kms/kms.go

    		KeyID:      name,
    		Version:    resp.Version,
    		Plaintext:  resp.Plaintext,
    		Ciphertext: resp.Ciphertext,
    	}, nil
    }
    
    func (c *kmsConn) Decrypt(ctx context.Context, req *DecryptRequest) ([]byte, error) {
    	aad, err := req.AssociatedData.MarshalText()
    	if err != nil {
    		return nil, err
    	}
    
    	ciphertext, _ := parseCiphertext(req.Ciphertext)
    	resp, err := c.client.Decrypt(ctx, &kms.DecryptRequest{
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Sun Aug 18 06:43:03 UTC 2024
    - 11.5K bytes
    - Viewed (0)
  9. internal/kms/errors.go

    		Err:     "key with given key ID does not exist",
    	}
    
    	// ErrDecrypt is an error returned by the KMS when the decryption
    	// of a ciphertext failed.
    	ErrDecrypt = Error{
    		Code:    http.StatusBadRequest,
    		APICode: "kms:InvalidCiphertextException",
    		Err:     "failed to decrypt ciphertext",
    	}
    
    	// ErrNotSupported is an error returned by the KMS when the requested
    	// functionality is not supported by the KMS service.
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Tue Jul 16 14:03:03 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  10. internal/kms/kes.go

    		}
    		if errors.Is(err, kes.ErrNotAllowed) {
    			return DEK{}, ErrPermission
    		}
    		return DEK{}, errKeyGenerationFailed(err)
    	}
    	return DEK{
    		KeyID:      name,
    		Plaintext:  dek.Plaintext,
    		Ciphertext: dek.Ciphertext,
    	}, nil
    }
    
    // ImportKey imports a cryptographic key into the KMS.
    func (c *kesConn) ImportKey(ctx context.Context, keyID string, bytes []byte) error {
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Sun Aug 18 06:43:03 UTC 2024
    - 7.3K bytes
    - Viewed (0)
Back to top